-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(biome_js_analyze): add two recommended rules in eslint-plugin-jsx-a11y #517
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments. I am happy to merge once they are addressed.
RuleDiagnostic::new( | ||
rule_category!(), | ||
node.range(), | ||
markup! { | ||
"Interactive elements should not be assigned non-interactive roles." | ||
}, | ||
) | ||
.note(markup! { | ||
"Wrap your interactive element in a <div> with the desired role or put the content inside your interactive element." | ||
}), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a note that tells the user why "Interactive elements should not be assigned non-interactive roles."
RuleDiagnostic::new( | ||
rule_category!(), | ||
node.range(), | ||
markup! { | ||
"Enforce elements with aria-activedescendant are tabbable." | ||
}, | ||
) | ||
.note(markup! { | ||
"Add the tabIndex attribute to the element with a value greater than or equal to -1." | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a note telling the user why they should enforce a tab index.
crates/biome_js_analyze/src/aria_analyzers/nursery/use_aria_activedescendant_tabindex.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/aria_analyzers/nursery/use_aria_activedescendant_tabindex.rs
Outdated
Show resolved
Hide resolved
...biome_js_analyze/src/aria_analyzers/nursery/no_interactive_element_to_noninteractive_role.rs
Outdated
Show resolved
Hide resolved
…tivedescendant_tabindex.rs Co-authored-by: Emanuele Stoppa <[email protected]>
…tivedescendant_tabindex.rs Co-authored-by: Emanuele Stoppa <[email protected]>
…ive_element_to_noninteractive_role.rs Co-authored-by: Emanuele Stoppa <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we could use shorter names for these rules?
...biome_js_analyze/src/aria_analyzers/nursery/no_interactive_element_to_noninteractive_role.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Victorien Elvinger <[email protected]>
Co-authored-by: Victorien Elvinger <[email protected]>
I think it would be better if possible, but I can't come up with a specific name. |
Yes. The only simplification I see is removing By the way, I think we already implemented the first rule... |
Yeah... These rules are very confusing... |
I updated diagnostic notes, so I merged. |
Summary
I added two recommended rules in eslint-plugin-jsx-a11y.
Test Plan
I added all test cases in eslint-plugin-jsx-a11y.