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)

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top