Apply the Five Rules of ARIA

In the last lesson, the Concerts page’s “Get tickets” div became a real <button>, and the first rule of ARIA was the reason: when HTML has an element that means the thing, use it. Four more rules turn it into a review you can run over any markup.

In this lesson, you’ll check markup against all five rules, see which roles the choir’s HTML already gives Tomás’s screen reader without any ARIA, and add the two states that HTML can’t express by itself.

Review Markup Against the Five Rules

A review works best as a fixed set of questions. The W3C’s note Using ARIA gives five rules, each one a question to ask of every element with a role or an aria- attribute:

  1. Is there a native HTML element or attribute that does this? Then use it instead.
  2. Does the ARIA change what a native element is? Don’t, unless there’s no other way.
  3. Does every interactive ARIA control work with the keyboard?
  4. Is role="presentation" or aria-hidden="true" on something focusable?
  5. Does every interactive element have an accessible name?

The last lesson’s div broke rule 3 as well as rule 1, so start there. Picture it with a role added:

Language: HTML
<div class="button get-tickets" role="button">Get tickets</div>

The Accessibility pane called it a button named “Get tickets”, but Tab skipped it. ARIA changes only what assistive technology is told. Keyboard behavior for a custom control takes JavaScript, so in this course, rule 3 always sends you back to rule 1.

Rule 2 catches the opposite move, where ARIA goes on an element that already means something. Say the Rehearsals page’s download link is styled as a button and given the matching role:

Language: HTML
<a href="rehearsal-schedule-spring-2027.txt" download role="button">
  Download the schedule
</a>

In Chromium 159, checked on November 28, 2026, the pane names it a button. But it still behaves as a link: Enter downloads the file, and Space, the key that presses a button, scrolls the page instead. Tomás is told one thing and gets another. Leave it a link, and let the stylesheet make it look like a button.

Rule 4 protects anything Tab can reach. Put role="presentation" on the Ticket prices button, and the pane still shows a button named “Ticket prices”, because browsers won’t strip the role from a focusable element. The browser overrules the author, so the markup no longer says what Tomás gets. Remove the role.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.