An element that is not a control reacts to clicks but not to the keyboard

tx0/ts:click-without-key-handlerstrictwarningreliability/collectionsdepth fastbug

What it finds

A <div> or <span> with onClick acts as a button for mouse users only. Keyboard users cannot reach or trigger it unless it also handles keys, and a <button> does both without extra code.

Reported are elements other than links, buttons and form controls with onClick and no onKeyDown, onKeyUp or onKeyPress, unless they spread attributes, are hidden with aria-hidden or have the role presentation or none.

From the rule's source, click_without_key_handler.rs.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:click-without-key-handler" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:click-without-key-handler] reason="..."

tx0 explain tx0/ts:click-without-key-handler shows the same in the terminal. Found a false positive? Report it.