Chapter 6 · Practice 1 of 4
Use native HTML elements before ARIA
From Accessibility
Why it matters
A <button> is focusable, works with Enter and Space, and is announced as a button by screen readers. A <div onClick> does none of that unless you add a role, a tab index and key handlers, and most people forget at least one.
Use the native element for the job:
<button>for actions,<a href>for navigation,- real headings, lists and landmarks like
<main>and<nav>.
Reach for ARIA attributes only when no native element fits, such as a custom combobox or tabs.
Do
- Use
<button type="button">for actions that are not form submits - Keep one
<h1>per page and do not skip heading levels
Avoid
- Clickable
<div>or<span>elements