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

Inconsistency in lint/a11y/noSvgWithoutTitle Lint Rule for aria-label and aria-labelledby #784

Closed
1 task done
k-s-h-r opened this issue Nov 19, 2023 · 1 comment · Fixed by #788
Closed
1 task done
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@k-s-h-r
Copy link

k-s-h-r commented Nov 19, 2023

Environment information

Version: 1.3.3

What happened?

I've encountered an issue with the lint/a11y/noSvgWithoutTitle lint rule, where the behavior of aria-label is incorrectly matching that of aria-labelledby. While aria-label can be used independently, aria-labelledby requires specifying an ID.

Current: Incorrect

Error Occurs

<svg
    role="img"
    aria-label="sample"
>
    <span id="title">pass</span>
</svg>

No Error Occurs

<svg
    role="img"
    aria-label="title"
>
    <span id="title">pass</span>
</svg>

Expected

No Error Should Occur with aria-label Specified Alone

<svg
    role="img"
    aria-label="title"
>
    <span>pass</span>
</svg>

Rule name

lint/a11y/noSvgWithoutTitle

Playground link

https://biomejs.dev/playground?code=PABkAGkAdgA%2BAAoAIAAgADwAaAAyAD4AQQBjAHQAdQBhAGwAbAB5ACAAdgBhAGwAaQBkADwALwBoADIAPgAKACAAIAAKACAAIAA8AHMAdgBnACAAcgBvAGwAZQA9ACIAaQBtAGcAIgAgAGEAcgBpAGEALQBsAGEAYgBlAGwAPQAiAHMAYQBtAHAAbABlACIAPgAKACAAIAAgACAAPABzAHAAYQBuAD4AcABhAHMAcwA8AC8AcwBwAGEAbgA%2BAAoAIAAgADwALwBzAHYAZwA%2BAAoAIAAgAAoAIAAgADwAcwB2AGcACgAgACAAIAAgAHIAbwBsAGUAPQAiAGkAbQBnACIACgAgACAAIAAgAGEAcgBpAGEALQBsAGEAYgBlAGwAbABlAGQAYgB5AD0AIgB0AGkAdABsAGUAIgAKACAAIAA%2BAAoAIAAgACAAIAAgACAAPABzAHAAYQBuACAAaQBkAD0AIgB0AGkAdABsAGUAIgA%2BAHAAYQBzAHMAPAAvAHMAcABhAG4APgAKACAAIAA8AC8AcwB2AGcAPgAKAAoAIAAgADwAcwBwAGEAbgA%2BAC0ALQAtAC0ALQAtAC0ALQAtAC0ALQAtAC0ALQAtAC0ALQAtAC0ALQAtAC0ALQAtADwALwBzAHAAYQBuAD4ACgAgACAACgAgACAAPABoADIAPgBBAGMAdAB1AGEAbABsAHkAIABpAG4AdgBhAGwAaQBkADwALwBoADIAPgAKACAAIAA8AHAAPgBUAGgAZQAgAGwAYQBiAGUAbAAgAHMAaABvAHUAbABkACAAYgBlACAAJwBwAGEAcwBzACcAIABiAHUAdAAgAGkAdAAgAGIAZQBjAG8AbQBlAHMAIAAnAHQAaQB0AGwAZQAnAC4APAAvAHAAPgAKACAAIAAKACAAIAA8AHMAdgBnAAoAIAAgACAAIAByAG8AbABlAD0AIgBpAG0AZwAiAAoAIAAgACAAIABhAHIAaQBhAC0AbABhAGIAZQBsAD0AIgB0AGkAdABsAGUAIgAKACAAIAA%2BAAoAIAAgACAAIAA8AHMAcABhAG4AIABpAGQAPQAiAHQAaQB0AGwAZQAiAD4AcABhAHMAcwA8AC8AcwBwAGEAbgA%2BAAoAIAAgADwALwBzAHYAZwA%2BAAoACgAgACAACgA8AC8AZABpAHYAPgA%3D

Expected result

The aria-label can be used on its own.
An error should not occur when only aria-label is used.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico ematipico added S-Help-wanted Status: you're familiar with the code base and want to help the project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Nov 19, 2023
@unvalley
Copy link
Member

@k-s-h-r Thank you for reporting, I'm working on #788

@unvalley unvalley self-assigned this Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
3 participants