Skip to content
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

fix(lint/noInteractiveElementToNoninteractiveRole): fix <source /> error case #4300

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

- Improved the message for unused suppression comments. Contributed by @dyc3

- Fix [#4228](https://github.com/biomejs/biome/issues/4228), where the rule `a11y/noInteractiveElementToNoninteractiveRole` incorrectlly reports a `role` for non interactive elements. Contributed by @eryue0220
- Catch suspicious semicolon in react fragment in `noSuspiciousSemicolonInJsx`. Contributed by @vasucp1207

### CLI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Rule for NoInteractiveElementToNoninteractiveRole {
{
// <div> and <span> are considered neither interactive nor non-interactive, depending on the presence or absence of the role attribute.
// We don't report <div> and <span> here, because we cannot determine whether they are interactive or non-interactive.
let role_sensitive_elements = ["div", "span"];
let role_sensitive_elements = ["div", "span", "source"];
if role_sensitive_elements.contains(&element_name.text_trimmed()) {
return None;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,15 @@
<Link href="http://x.y.z" role="img" />;
<Link href="http://x.y.z" />;
<Button onClick={doFoo} />;
<picture>
<source
srcSet={'/assets/head.webp'}
role='img'
type='image/webp'
/>
<img
src={'/assets/head.png'}
alt='An ASCII-style headshot'
/>
</picture>

Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,17 @@ expression: valid.jsx
<Link href="http://x.y.z" role="img" />;
<Link href="http://x.y.z" />;
<Button onClick={doFoo} />;
<picture>
<source
srcSet={'/assets/head.webp'}
role='img'
type='image/webp'
/>
<img
src={'/assets/head.png'}
alt='An ASCII-style headshot'
/>
</picture>


```