How to test
Links & Buttons

Testing links and buttons is essential to ensuring a site is accessible and functional for all users.

1 How to test

Test with your keyboard first

Navigate through the page using only the tab and shift + tab keys on your keyboard to reach all links and buttons.

Test with screen readers second

Use a screen reader, such as NVDA (for Windows) or VoiceOver (for macOS) and browse the page using your arrow keys to reach all links and buttons.

2 What to test for

Pass Fail
I get focus! I do NOT get focus
Pass Fail
Show alert
Magentaa11y home Magentaa11y home

✓ Ensure disabled controls are focusable but not actionable, and have an aria-disabled="true" attribute

Preferred Disabled but not focusable
Pass Fail
Learn more about links Learn more
Pass Fail
This button expressed its state as expanded or collapsed
This button is not conveying it's state.
Pass Fail
Return to top Return to top
Pass Fail
Home
Open a modal Open a modal
  • When the user clicks a link, they are taken to a different location in the site.
    • Either another page or even another area of the same page
  • A link can look like a big shiny button but it must be coded as <a> link
  • An interactive link should have a valid href value so it can receive keyboard focus.
    For example <a href="/some-page">...</a>.

If it does something, it’s a <button>

  • Buttons cause an action to occur on the same page
    • Submit a form (even when submission takes you to a new page)
    • Open a menu
    • Launch a modal
    • Expand details
  • A button can look like a link, but it must be coded as a <button>
  • 2.4.4 Link Purpose (In Context)
  • 2.5.3 Label in Name
  • 3.2.4 Consistent Identification
  • 4.1.2 Name, Role, Value

Resources