Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.ui

Declare a widget role when mixing click and key handlers

Elements that handle both clicks and key events behave like custom controls and should advertise an appropriate ARIA role.

#Metadata

Rule ID
ts.react.no-keyboard-interaction-without-widget-role
Severity
medium
Confidence
0.8
Languages
javascript, typescript
Presets
strict
Stability
experimental
Applies to
function
Tags
accessibility, react, rules-catalog, ui

#Why it matters

Assistive technologies cannot infer widget behaviour from events alone; an explicit role pairs keyboard support with the correct accessibility tree semantics.

#Remediation

Set `role="button"` or another fitting widget role, ensure focusability, and mirror native control keyboard patterns.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.react.no-keyboard-interaction-without-widget-role.rule.yaml.