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: noSvgWithoutTitle skip on aria-hidden #928

Merged
merged 23 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cb1438e
refactor(linter): UseAnchorContent code action
vasucp1207 Oct 7, 2023
364f018
refactor(linter): UseAnchorContent code action
vasucp1207 Oct 7, 2023
d94d9e1
refactor(linter): UseAnchorContent code action
vasucp1207 Oct 7, 2023
5517a6b
Merge branch 'biomejs:main' into main
vasucp1207 Oct 8, 2023
0d46365
Merge branch 'biomejs:main' into main
vasucp1207 Oct 12, 2023
4d11c7c
Merge branch 'biomejs:main' into main
vasucp1207 Oct 15, 2023
aa3d3a5
Merge branch 'biomejs:main' into main
vasucp1207 Oct 19, 2023
a39dad7
Merge branch 'biomejs:main' into main
vasucp1207 Oct 22, 2023
281c6a2
Merge branch 'biomejs:main' into main
vasucp1207 Oct 25, 2023
f3fb5d1
Merge branch 'biomejs:main' into main
vasucp1207 Oct 29, 2023
76b3f81
Merge branch 'biomejs:main' into main
vasucp1207 Oct 29, 2023
103bc72
Merge branch 'biomejs:main' into main
vasucp1207 Oct 31, 2023
63186c9
Merge branch 'biomejs:main' into main
vasucp1207 Nov 3, 2023
8138132
Merge branch 'biomejs:main' into main
vasucp1207 Nov 4, 2023
f276c68
Merge branch 'biomejs:main' into main
vasucp1207 Nov 16, 2023
5e968fc
Merge branch 'biomejs:main' into main
vasucp1207 Nov 17, 2023
736d2f1
Merge branch 'biomejs:main' into main
vasucp1207 Nov 21, 2023
4d6153a
Merge branch 'biomejs:main' into main
vasucp1207 Nov 21, 2023
517cac3
Merge branch 'biomejs:main' into main
vasucp1207 Nov 21, 2023
e833968
Merge branch 'biomejs:main' into main
vasucp1207 Nov 23, 2023
86ed25f
Merge branch 'biomejs:main' into main
vasucp1207 Nov 25, 2023
9c1cf36
Merge branch 'biomejs:main' into main
vasucp1207 Nov 28, 2023
10b470a
fix: noSvgWithoutTitle skip on aria-hidden
vasucp1207 Nov 28, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ impl Rule for NoSvgWithoutTitle {
return None;
}

if let Some(aria_hidden_attr) = node.find_attribute_by_name("aria-hidden") {
if let Some(attr_static_val) = aria_hidden_attr.as_static_value() {
let attr_text = attr_static_val.text();
if attr_text == "true" {
return None;
}
}
}

// Checks if a `svg` element has a valid `title` element is in a childlist
let jsx_element = node.parent::<JsxElement>()?;
if let AnyJsxElement::JsxOpeningElement(_) = node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@
<title>implicit role</title>
<span>Pass</span>
</svg>

<svg aria-hidden="true">
<defs>
<pattern>
<path d="M.5 200V.5H200" fill="none" />
</pattern>
</defs>
</svg>
</>;
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ expression: valid.jsx
<title>implicit role</title>
<span>Pass</span>
</svg>

<svg aria-hidden="true">
<defs>
<pattern>
<path d="M.5 200V.5H200" fill="none" />
</pattern>
</defs>
</svg>
</>;

```
Expand Down