Use Semantic HTML Elements Before Adding ARIA
Overview
Semantic elements reduce custom code and provide reliable browser and assistive technology behavior.
Choose elements by purpose
Use headings to structure content, buttons for actions, anchors for navigation, lists for grouped items, and native form controls for input. A main element identifies the primary content, while header, footer, and nav provide useful landmarks when used appropriately. Semantic HTML communicates intent without extra scripting.
Avoid recreating native behavior
A clickable div does not automatically support keyboard input, focus, disabled state, or expected announcements. A custom button must recreate all of those behaviors. Prefer a native button unless there is a compelling reason not to.
Add ARIA only to fill a real gap
ARIA can provide names, relationships, states, and roles when native HTML is insufficient. Incorrect ARIA can make a control less understandable. Do not add redundant roles such as role="button" to a native button, and do not change a semantic role merely to influence styling.
Validate the accessibility tree
Inspect the browser accessibility tree and test with assistive technology. Confirm that names and states match what users see and that dynamic changes are announced when necessary. The first question should be whether the markup is correct, not which ARIA attribute can patch it.
Implementation checklist
- Define the expected behavior and supported environments.
- Keep security, accessibility, and failure states in the design.
- Measure the result with representative user journeys.
- Document operational assumptions and review them after changes.