fix(linter/no-noninteractive-tabindex): handle numeric tabIndex values on non-interactive elements#20538
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
Fixes jsx-a11y/no-noninteractive-tabindex so it also flags non-interactive elements when tabIndex is provided as a numeric JSX expression (e.g. tabIndex={0}), aligning behavior with React’s tabIndex?: number typing and the linked issue.
Changes:
- Parse
tabIndexvalues beyond just string literals (handles numeric expression containers like{0}). - Tighten rule applicability to native DOM tags (via
HTML_TAG) and keep early exits for interactive elements / allowed tags / allowed roles. - Update rule tests and snapshot output to cover the newly-detected failing cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_linter/src/rules/jsx_a11y/no_noninteractive_tabindex.rs | Extends tabIndex value parsing to numeric expressions and adjusts role handling logic / DOM-tag gating. |
| crates/oxc_linter/src/snapshots/jsx_a11y_no_noninteractive_tabindex.snap | Updates expected diagnostics to include the new failing cases (e.g. tabIndex={0}). |
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
8b6c3b1 to
9519380
Compare
…s on non-interactive elements (oxc-project#20538) fixes oxc-project#20471

fixes #20471