I have been using the Mac OSX's built in screen-reader for testing my site, I know it's not the best but it's all I have for now. But I'm finding it isn't pausing at the end of elements... which makes sense; but I'm finding myself placing hidden periods to make things readable:
<div class="breakdown">
<strong>35</strong> New<span class="visuallyhidden">.</span><br>
<strong>4</strong> Overdue<span class="visuallyhidden">.</span>
</div>
I feel really dirty doing this, but if I dont then either it ruins the design, or it is read in a continuous sentence which is not comprehensible.
Does anyone have an experience of this kind of thing to offer?
If you format your code semantically, it should work fine. By the looks of your HTML structure, you're using a <br>
tag for presentational purposes. This is not what line breaks are meant for, and thus is not a semantic use of markup.
You specifically want each line to be separate, so you should put them in wrapping block level tags. You could wrap each line in a p
or div
tag, and then the screen reader will separate them properly.
I suggest using aria-label
when you would like the screen reader to speak something different than the content contained within the tag's html markup.
I would update your code to be:
<div class="breakdown">
<span aria-label="35 New.">
<strong>35</strong> New
</span>
<br>
<span aria-label="4 Overdue.">
<strong>4</strong> Overdue
</span>
</div>
With this, a screen reader will speak the following with full pauses at each period:
35 New. 4 Overdue.
We are specifically targeting ChromeVox, but this should work for all screen readers.
aria-label
aria-label
and how I see it used often in other projects.aria-label
strings are faster to read/grok/edit for humans.aria-label
than hidden elements.aria-label
. Snapshots will also capture changes, but devs have to be aware of this.aria-label
. If the user selects text on the screen and the selection spans content which is in a hidden element, the hidden content will be copied when the user performs the copy command, and pasted when the user performs the paste command.Considering all pros/cons, long-term my bet is that you will find that choosing aria-label
will provide the best developer, translator, and user accessibility experience.
If an element is described by a sibling element's text content, consider using aria-labeledby
to link elements.
This answer is coming in 6 years after being asked… but hopefully it will be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With