Question

I have the element: <div id="container-div" role="region"></div>

When the user will click the key 'R' I want the screen reader reads the words

"this is XXX area region"

without adding new label or element in the DOM.

(It's really important to keep the DOM clean without an extra hidden labels)

Was it helpful?

Solution

Just add an aria-label attribute, like this:

<div id="container-div" role="region" aria-label="This is an XXX">

Tip: don't use the word Region in your description since screen readers (at least JAWS) add it themselves. So, if you write "This is an XXX area region", a screen reader would say "This is an XXX area region region" because of the role.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top