From b8622830af47c95a6df9246d67fcf1e93ebb24db Mon Sep 17 00:00:00 2001
From: Detlev Fischer Description
This technique uses the status
role from the ARIA specification to notify Assistive Technologies (AT) when content has been updated with information about the user's or application's status. This is done by adding role="status"
to the element that contains the status message. The aria live region role of status
has an implicit aria-live
value of polite
, which allows a user to be notified via AT (such as a screen reader) when status messages are added. The role of status
also has a default aria-atomic
value of true
, so that updates to the container marked with a role of status
will result in the AT presenting the entire contents of the container to the user, including any author-defined labels (or additional nested elements). Such additional context can be critical where the status message text alone will not provide an equivalent to the visual experience. The content of the aria-live container is automatically read by the AT, without the AT having to focus on the place where the text is displayed. See WAI-ARIA 1.1 status (role) for more details.
Lack of support of the default value of aria-atomic
in some environments means that it is advisable to add an explicit aria-atomic="true"
if the entire contents of the container should be read.
After a user presses a Search button, the page content is updated to include the results of the search, which are displayed in a section below the Search button. The change to content also includes the message "5 results returned" near the top of this new content. This text is given an appropriate role for a status message. A screen reader will announce "Five results returned".
- <div role="status">5 results returned.</div>
+ <div role="status" aria-atomic="true">5 results returned.</div>
Working example: role=status on search results
@@ -40,7 +40,7 @@After a user presses an Add to Shopping Cart button, content near the Shopping Cart icon updates to read "1 items". The container for this text (in this case a <p>
) is marked with the role of status
. Because it adds visual context, the shopping cart image -- with succinct and accurate ALT text -- is also placed in the container. Due to the default aria-atomic
value, a screen reader will announce "Shopping cart, six items".
- <p role="status" >
+ <p role="status" aria-atomic="true">
<img src="shopping-cart.png" alt="Shopping Cart">
<br>
<span id="cart">0</span> items
From 466505e0560e7453e0d1e69132df688b240cc26b Mon Sep 17 00:00:00 2001
From: Detlev Fischer
Date: Thu, 25 Mar 2021 11:00:38 +0100
Subject: [PATCH 2/3] Update index.html
---
working-examples/aria-role-status-shoppingcart/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/working-examples/aria-role-status-shoppingcart/index.html b/working-examples/aria-role-status-shoppingcart/index.html
index a36fe2ac83..1c4cf71f59 100644
--- a/working-examples/aria-role-status-shoppingcart/index.html
+++ b/working-examples/aria-role-status-shoppingcart/index.html
@@ -17,7 +17,7 @@
Using role=status
to Provide Status Message on Shopping Cart
This simple script demonstrates how a shopping cart counter is updated and surfaced using the aria status
role. Here the role is placed on the paragraph containing the dynamically updated text, and the shopping cart image's alt provides additional context. Due to the default aria-atomic="true"
, a screenreader should announce "Shopping Cart # items" or (depending on browser compatibility) "# items" each time the Buy Pink Flamingos button is selected.
-
+
0 items
Shop at our single-product store
From 1ce3c868f3413eea0ae25e9f0db4d4697987afb7 Mon Sep 17 00:00:00 2001
From: Detlev Fischer
Date: Thu, 25 Mar 2021 11:02:29 +0100
Subject: [PATCH 3/3] Update index.html
---
working-examples/aria-role-status-searchresults/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/working-examples/aria-role-status-searchresults/index.html b/working-examples/aria-role-status-searchresults/index.html
index ed7985ab7c..4b2f5f57fc 100644
--- a/working-examples/aria-role-status-searchresults/index.html
+++ b/working-examples/aria-role-status-searchresults/index.html
@@ -19,7 +19,7 @@ Using role=status
to Provide Status Message on Search Results
Results
-
+