Generally, ARIA attributes—like
But there’s one instance where I actually put the ARIA attribute directly in the HTML that gets sent from the server:
If you’re not familiar with it,
aria-live is extremely useful if you’ve got any dynamic updates on your page—via Ajax, for example. Let’s say you’ve got a bit of your site where filtered results will show up. Slap an
aria-live attribute on there with a value of “polite”:
<div aria-live="polite"> ...dynamic content gets inserted here </div>
You could instead provide a value of “assertive”, but you almost certainly don’t want to do that—it can be quite rude.
But I picked up a handy lesson from Ire’s excellent post on using
Assistive technology will initially scan the document for instances of the aria-live attribute and keep track of elements that include it. This means that, if we want to notify users of a change within an element, we need to include the attribute in the original markup.
Good to know!