carston1998
carston1998

Reputation: 1

ARIA for adding or removing a DIV

When adding or removing a DIV to HTML, what ARIA attributes should I use to signal screen readers? I've been using ARIA-HIDDEN when showing or hiding DIVs.

Upvotes: 0

Views: 1325

Answers (1)

slugolicious
slugolicious

Reputation: 17535

If adding and removing elements is a significant event and you want the screen reader to know about it, then you'll need a combination of aria-live='assertive' (so that it's announced immediately) and aria-relevant='all'. These should be set on the parent container - the <div> that will contain the new <div>s you're creating.

By default, aria-relevant will only announce changes in text or the addition of an element. If you want to notify the screen reader that the <div> was removed, then the value will need to be 'all'.

http://www.w3.org/TR/wai-aria/states_and_properties#aria-live
http://www.w3.org/TR/wai-aria/states_and_properties#aria-relevant

Upvotes: 2

Related Questions