Why a clickable div is not a button: keyboard and screen reader users are locked out
A payment button built from a div with an onClick handler works for mouse users but is skipped by keyboard navigation and read as plain text by screen readers. Native button and link elements receive Tab focus, respond to Enter and Space, and are announced as interactive controls by assistive technology without extra work. The article recommends swapping the element for a real button with type="button" and a visible focus style, or a link when the action navigates to another page. If a library renders such a wrapper, developers must add the role, tab index and key handling manually. Linting rules such as jsx-a11y and automated pull request checks can catch this pattern before release.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in