{"id":4617,"date":"2021-08-05T14:00:00","date_gmt":"2021-08-05T18:00:00","guid":{"rendered":"http:\/\/www.equipmentlink.org\/blog\/?p=4617"},"modified":"2021-08-04T16:39:21","modified_gmt":"2021-08-04T20:39:21","slug":"aria-live-announcements","status":"publish","type":"post","link":"http:\/\/www.equipmentlink.org\/blog\/?p=4617","title":{"rendered":"ARIA-LIVE Announcements"},"content":{"rendered":"\n<p>Welcome to more ARIA content.&nbsp; This post focuses specifically on aria-live regions, which announce dynamic content in conjunction with Javascript.&nbsp; The most common use of this tool is in forms that change based on user inputs.&nbsp;<\/p>\n<p>The aria-live attribute itself has three settings: <em>off<\/em>, <em>polite<\/em>, and <em>assertive<\/em>.&nbsp; By default, elements are assumed to have aria-live=<em>off<\/em> applied to them, unless a specific role that uses it, such as <em>alert<\/em>, is present.&nbsp; Aria-live=<em>polite<\/em> is probably the most common use of the attribute; it waits for a user to pause or complete their action before announcing the dynamic change.&nbsp; <em>Assertive<\/em> will interrupt anything the user is currently reading; generally, this should only be used for critical information such as a timeout.&nbsp; Note that this attribute can applied to different elements to accomplish different purposes.&nbsp; W3C provides an example of it being used as an alert on a &lt;p&gt; tag (<a href=\"https:\/\/www.w3.org\/TR\/WCAG20-TECHS\/ARIA19.html\">https:\/\/www.w3.org\/TR\/WCAG20-TECHS\/ARIA19.html<\/a>) to provide feedback about errors in a form.&nbsp; Mozilla provides an example of a &lt;div&gt; having the attribute, announcing content based on a selection from a &lt;select&gt; field (<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/Accessibility\/ARIA\/ARIA_Live_Regions\">https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/Accessibility\/ARIA\/ARIA_Live_Regions<\/a>).&nbsp;<\/p>\n<p>Note the differences in the ARIA attributes present. W3C\u2019s example uses role=<em>alert <\/em>but does not have aria-live on &lt;p&gt; tag as well.&nbsp; This is because the alert role has this functionality integrated in it.&nbsp; If you wanted to achieve the same effect without using that role, you would add aria-live=<em>assertive<\/em> along with a different role, such as region which creates a landmark for users to know this information is important.&nbsp; Other roles that have implicit live announcements are <em>log<\/em>, <em>status<\/em>, <em>progressbar<\/em>, <em>marquee<\/em>, and <em>timer<\/em>.&nbsp; Most of these use aria-live=<em>polite<\/em> by default.<\/p>\n<p>A couple other ARIA attributes that tie into this are aria-atomic and aria-relevant.&nbsp; Aria-atomic, which uses <em>true<\/em> or <em>false<\/em> as its value, decides if the content provided is announced as a whole or just the parts that have changed.&nbsp; In the W3C example, it is set to <em>true<\/em> which means everything that appears in that &lt;p&gt; tag is announced together.&nbsp; If it was set to <em>false<\/em> or was not present, only new information that was injected (such as a new error) would be announced the next time it was read.&nbsp; Aria-relevant instead looks to the types of changes made to determine what is announced.&nbsp; It uses the values <em>additions<\/em>, <em>removals<\/em>, <em>text<\/em>, and <em>all<\/em>.&nbsp; In the linked Mozilla example, further down that page is an example of \u201c<em>additions removals<\/em>\u201d being used to announce changes in a list of users logged into a system.&nbsp; In this scenario, both values are present in the attribute so both filters are used.&nbsp; Remember, for attributes such as ARIA, class, or ID, spaces are separate values (i.e. class=\u201dtable row\u201d is actually class=\u201dtable\u201d and class=\u201drow\u201d being applied to a single element).&nbsp;<\/p>\n<p>Aria-live is a bit trickier than other attributes since it relies on content to change in a page and you\u2019ll need to determine how best to bring that information to the user\u2019s attention.&nbsp; As stated before, <em>assertive<\/em> should really only be used when information is critical because it\u2019s time-sensitive, a security issue, or a similar reason.&nbsp; For the most part, rely on <em>polite<\/em>.&nbsp; Lastly, make sure your Javascript is injecting content into the right region; you will likely need to use unique IDs if you are separating out areas for different dynamic content on a page.&nbsp;<\/p>\n<div class=\"al2fb_like_button\"><div id=\"fb-root\"><\/div><script type=\"text\/javascript\">\n(function(d, s, id) {\n  var js, fjs = d.getElementsByTagName(s)[0];\n  if (d.getElementById(id)) return;\n  js = d.createElement(s); js.id = id;\n  js.src = \"\/\/connect.facebook.net\/en_US\/all.js#xfbml=1&appId=149587675112835\";\n  fjs.parentNode.insertBefore(js, fjs);\n}(document, \"script\", \"facebook-jssdk\"));\n<\/script>\n<fb:like href=\"http:\/\/www.equipmentlink.org\/blog\/?p=4617\" layout=\"standard\" show_faces=\"true\" share=\"false\" width=\"450\" action=\"like\" font=\"arial\" colorscheme=\"light\" ref=\"AL2FB\"><\/fb:like><\/div>","protected":false},"excerpt":{"rendered":"<p>Welcome to more ARIA content.&nbsp; This post focuses specifically on aria-live regions, which announce dynamic content in conjunction with Javascript.&nbsp; The most common use of this tool is in forms that change based on user inputs.&nbsp; The aria-live attribute itself has three settings: off, polite, and assertive.&nbsp; By default, elements are assumed to have aria-live=off [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"yes","ngg_post_thumbnail":0,"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4617"}],"collection":[{"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4617"}],"version-history":[{"count":1,"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4617\/revisions"}],"predecessor-version":[{"id":4618,"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4617\/revisions\/4618"}],"wp:attachment":[{"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4617"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.equipmentlink.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}