feat(linter): implement jsx-a11y/no-noninteractive-element-interactions#17608
feat(linter): implement jsx-a11y/no-noninteractive-element-interactions#17608Kenzo-Wada wants to merge 9 commits intooxc-project:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements the jsx-a11y/no-noninteractive-element-interactions linter rule to enforce accessibility best practices by preventing mouse and keyboard event handlers on non-interactive HTML elements and ARIA roles.
Key changes:
- Adds rule logic to detect event handlers on semantic non-interactive elements (like
<li>,<h1>,<article>) and elements with non-interactive ARIA roles - Distinguishes between interactive and non-interactive roles, with special handling for abstract roles
- Integrates with existing accessibility utilities for screen reader visibility and presentation role detection
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_linter/src/rules/jsx_a11y/no_noninteractive_element_interactions.rs | Main rule implementation with element/role classification, handler detection logic, and comprehensive test cases |
| crates/oxc_linter/src/rules.rs | Registers the new rule module in the jsx_a11y rules collection |
| crates/oxc_linter/src/generated/rule_runner_impls.rs | Adds RuleRunner implementation specifying JSXOpeningElement as the target node type |
| crates/oxc_linter/src/snapshots/jsx_a11y_no_noninteractive_element_interactions.snap | Test snapshot file capturing expected diagnostic output for all test cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/oxc_linter/src/rules/jsx_a11y/no_noninteractive_element_interactions.rs
Show resolved
Hide resolved
crates/oxc_linter/src/rules/jsx_a11y/no_noninteractive_element_interactions.rs
Outdated
Show resolved
Hide resolved
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
…_interactions.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Kenzo Wada <79452224+Kenzo-Wada@users.noreply.github.com>
|
Updated the PR description with the original docs/source/tests for ease of review :) |
|
I've implemented |
|
I have now also added There are a large number of tests missing in this implementation as well, for example all tests for the recommended options (the recommended config match the defaults in this impl and so should be added/pass), like the one for More tests are missing, such as the ones listed in the There is also missing logic, such as an equivalent to the I am assuming this was PR generated using AI tooling, accordingly please update the PR description to note any and all AI usage in accordance with our policy, preferably including models/tools used and a confirmation that you have personally reviewed the code generated and ensured it works/makes sense: https://oxc.rs/docs/contribute/introduction.html#ai-usage-policy If the PR description is not updated in a timely manner, we will opt to close this PR to avoid maintainer fatigue and prevent spending too much time on contributions not thoroughly reviewed by the contributor. |
|
ill fix it on few days! thanks for your review :) |
…_interactions.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Kenzo Wada <79452224+Kenzo-Wada@users.noreply.github.com>
related: #1141
This PR is published with my friend Claude Code Max(model: opus 4.5). but all reviewed by me, and i am responsible for all the changes.