Keyboard Accessibility
Interactive functionality must be usable without a mouse. Native buttons, links, inputs, and form controls already provide keyboard interaction. Avoid replacing these controls with clickable generic elements unless there is a strong reason and all required behavior is implemented.
Use a Button for Actions
<button type="button" id="saveButton">Save</button>💡 A button is inherently interactive and supports keyboard interaction and accessibility semantics.
Key Takeaways
- Native interactive elements are keyboard accessible by default.
- Do not use a div as a button merely because it is easy to style.
Knowledge Check
Which is the best native element for triggering an action?