Showing posts with label ARIA. Show all posts
Showing posts with label ARIA. Show all posts

Tuesday, 11 July 2017

ARIA Role Alert

The ARIA role is used to convey time sensitive and important information to the user without interrupting their current work process. The role="alert" must be provided to an element which holds the alert message. It is not required for author or developer to change or move user keyboard focus to the alert message when role alter is used. Screen reader picks the role alert and announces it for user even though the keyboard focus is  not on the alert message. It benefits user as their keyboard focus navigation flow is not disturbed.

Example : <p role="alert">Low battery. Please plugin to continue</p>

Whenever content having role alert is dynamically added in the page, screen reader stops announcing the present content and announces the dynamically added content with out disturbing the current keyboard focus. For example, assume screen reader is announcing a paragraph content present in middle of the page. So ideally focus is also present at paragraph content. Assume an alert message appears suddenly at top of the page. In this case screen reader stops reading the paragraph and announces the alert message without changing the keyboard focus to alert message. After completion of alert message, on hit of down arrow, screen reader continues reading the current paragraph which is in middle of the page. Hence with help of role alert, the important time sensitive information is conveyed to user without change in navigation flow or keyboard focus.

By default, when role="alert" is provided for an element, it implies the particular element has aria-live="assertive" and aria-atomic="true". Hence when role alert is provided then it is not required to use aria-live and aria-atomic properties.

Below are some scenarios when aria role="alert" can be used.

  1. A text field where validation happens on the go when user start typing some value in the field. Ex: In email text field, if user enters special character other than @, an error message is shown immediately before user completes entering email. Here if role alert is provided for error message, screen reader announces it for user even though keyboard focus is in text field.
  2. An online test where an alert is shown at top of the page when test time is about to complete. Ex: In online exam where user keyboard focus is at 45th question and an alert message is shown at top of the page stating "Only five minutes left". Here the error message is informed to user even though keyboard focus is at 45th question.
  3. A storm alert message in a weather reporting website. Ex: User is browsing a weather report website. Suddenly an alert message is displayed on top of the screen "New Jersey weather alert: Thunderstorm and rain from 11am to 3pm." In this case, role="alert" must be provided for the alert message.

Key Points

  1. The alert message should not disappear without user notice. Also, make sure that page doesn't contain too many alert messages as frequent interruptions makes it difficult for some users to continue working on the page.
  2. The role alert is intended to provide time sensitive and important information for user without effecting user keyboard focus. If the alert message requires a change in keyboard focus or requires a user input, then it is recommended to use role 'alertdialog' instead of role 'alert'. Ex: A time-out notification where a dialog is shown with 'yes' and 'no' buttons in it. Here role alertdialog must be used instead of role alert.

Thursday, 13 October 2016

ARIA Role Region

ARIA Role REGION



ARIA role region is assigned to a section of a page which contains sufficiently important information for the user. ARIA region should be used only when the particular section cannot be marked with landmark roles such as main, complementary, navigation etc. By providing role region to important content it would be easy for the user to navigate to the section.


<div role=”region”>
Section content comes here…
</div>


Along with role region, a brief description should be provided so that user knows purpose of the content present in the section. Developers/consultants can use aria-labelledby to associate the section with a visible label or text on the page. The visible label or text must be in heading tag h1 to h6 based on the hierarchy or should have role heading.

<div role=”region” aria-labelledby=”sectionHeader”>
<h3 id=”sectionHeader”>Feedback</h3>
Section content comes here…
</div>


Aria-label can also be used to convey the purpose of the content present in the section.
<div role=”region” aria-label=”feedback”>
Section content comes here…
</div>


NVDA or JAWS screen reader will announce a section as region only if it has role region as well as aria-labelledby or aria-label to describe the content present in the section.


References: