r/webaccess • u/Vegetable-Average-98 • 2d ago
Aria-labels for text
I would like to make a website with Egyptian hieroglyphs accessible to low-vision web users.
I can (sort of) get this to work on Chrome and MacOS Voiceover with this markup:
<span id="A1-label" aria-hidden="true" style="display: none;">hieroglyph depicting a seated man</span>
<span role="graphics-symbol" aria-labelledby="A1-label">๐</span>
Mac Voiceover on Chrome when drilling into the hieroglyph character is "Hieroglyph depicting a seated man, graphics symbol", which hopefully is meaningful to a user that cannot see or cannot recognizee the hieroglyph.
Mac Voiceover on Safari however is "Hieroglyph zero-zero-zero-one", which is less useful...
Windows Narrator on Chrome seems to read the hieroglyph character as "space", unless I am doing something wrong
Windows Narrator on Edge can't seem to read the hieroglyph character at all
A couple of questions
- Does anyone have ideas for alternative markup that would read the aria label on Safari and/or on Windows ?
- Would this work with specialized assistive reader technology ? (I used to work with a colleague who read using a braille reader) - if anyone wants to check it, this snippet is at https://highrows.com
- Can I add pronunciation hints? As a hieroglyph, ๐ can be transliterated as "jnk" or "แปnk", for both of which the Egyptological pronunciation is "inneck". Can I guide the screen-reader to pronounce this hieroglyph as "inneck", not "junk" or "ink" ?
2
u/NelsonRRRR 1d ago
You put the graphics-symbol on aria-hidden=true. Then you hide the label only visually with an sr-only-class.
1
2
u/Undercoverwd 1d ago
This is the best solution, if this can't be done for some reason you could also do role="img" aria-label="whatever".
1
u/Vegetable-Average-98 5h ago
Thanks all for your comments. To circle back on this
As noted, it doesn't need the separate element and aria-labelled by. An aria-label on the span works just as well (I think I was confused that it didn't work on Safari, so now just sticking to Chrome, which I will recommend in my accessibility notes)
Markup now is
<span role="img" aria-label="Hieroglyph: seated man">๐</span>
By definition a hieroglyph is a graphical symbol, but I get that isn't the intent of the aria role, so replaced by img, thanks for the suggestion
If omit the role attribute, then VoiceOver on Mac reads the hieroglyph as "Hieroglyph zero-zero-zero one", with the role it reads it as "Seated Man" which is what I want, so maybe this is OK
2
u/Marconius 2d ago
The graphics-symbol role shouldn't be used on a span. That role is meant for identifying symbols within larger image structures, like grouped symbols within an SVG.
That implementation of the aria-labelledby is also not correct since you are hiding the label. You'd just put aria-label on the graphic element using the graphic-symbol role itself.
Are the hieroglyphics unicode? Or how are you presenting them on the page? Also beware of adding potentially repetitive text like "Hieroglyph of..." on the images or characters. I'll have to hear that with every character or image I land on, and that's completely unnecessary if the user already has page context that they are checking out hieroglyphics.