Skip to content

fix(linter/no-noninteractive-tabindex): handle numeric tabIndex values on non-interactive elements#20538

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/03-19-fix_linter_no-noninteractive-tabindex_handle_numeric_tabindex_values_on_non-interactive_elements
Mar 19, 2026
Merged

fix(linter/no-noninteractive-tabindex): handle numeric tabIndex values on non-interactive elements#20538
graphite-app[bot] merged 1 commit intomainfrom
c/03-19-fix_linter_no-noninteractive-tabindex_handle_numeric_tabindex_values_on_non-interactive_elements

Conversation

@camc314
Copy link
Copy Markdown
Contributor

@camc314 camc314 commented Mar 19, 2026

fixes #20471

Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 19, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Mar 19, 2026
@camc314 camc314 self-assigned this Mar 19, 2026
@camc314 camc314 marked this pull request as ready for review March 19, 2026 23:18
Copilot AI review requested due to automatic review settings March 19, 2026 23:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 tabIndex values 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}).

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 19, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 52 skipped benchmarks1


Comparing c/03-19-fix_linter_no-noninteractive-tabindex_handle_numeric_tabindex_values_on_non-interactive_elements (8b6c3b1) with main (57b2e82)2

Open in CodSpeed

Footnotes

  1. 52 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (2c50654) during the generation of this report, so 57b2e82 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 19, 2026
Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 19, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/03-19-fix_linter_no-noninteractive-tabindex_handle_numeric_tabindex_values_on_non-interactive_elements branch from 8b6c3b1 to 9519380 Compare March 19, 2026 23:44
@graphite-app graphite-app bot merged commit 9519380 into main Mar 19, 2026
21 checks passed
@graphite-app graphite-app bot deleted the c/03-19-fix_linter_no-noninteractive-tabindex_handle_numeric_tabindex_values_on_non-interactive_elements branch March 19, 2026 23:49
costajohnt pushed a commit to costajohnt/oxc that referenced this pull request Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: jsx-a11y no-noninteractive-tabindex doesn't work for 0 index when set as string

2 participants