Ask a coding agent for a "Save" button and you sometimes get this:
<div class= "btn" onclick= "save()" > Save </div>
Enter fullscreen mode
Exit fullscreen mode
Run it through the Nu HTML Checker: valid. Run it through axe-core: no violations. Ship it.
Now press Tab. Nothing focuses it. Press Enter: nothing happens. A keyboard user, or anyone on a screen reader, cannot use your Save button, and both of the tools you trusted said it was fine.
Why the validators pass it
A <div onclick> is well-formed HTML. Nu checks that the markup is valid, and a div is valid. axe checks the rendered page against a set of known accessibility failures, and a plain div with a click handler does not reliably match a rule it can detect, because axe cannot know the div was meant to be a button.
That is the gap: the mistake is choosing the wrong element, and that choice happens before anything gets validated.…