-
-
Notifications
You must be signed in to change notification settings - Fork 462
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 svelte 4 warning #1635
Fix svelte 4 warning #1635
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 think the warning is a false positive, and I don't think this is the right way to solve it.
Ideally, the Link
component should always be used to render an <a>
or <button>
, which already comes with the correct role by default.
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/link_role#best_practices
Adding the role unnecessarily seems like it's against the best practices, and interestingly it goes against the a11y-no-redundant-roles
rule.
Ideally, the warning would be smart enough to only appear if someone chooses to render something other than an a
or button
; in that case, it should be on them to add the correct role for their situation. I'm not sure whether this is possible, though.
Assuming that isn't possible, this might be an appropriate case for an ignore per https://svelte.dev/docs/accessibility-warnings. E.g:
<!-- svelte-ignore a11y-a11y-no-static-element-interactions -->
@@ -12,6 +12,8 @@ | |||
export let only = [] | |||
export let headers = {} | |||
export let queryStringArrayFormat = 'brackets' | |||
export let role = 'link' |
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.
This could potentially be a "button" as well, right?
{role} | ||
{tabindex} |
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.
Shouldn't these only be added if as
is not a
or button
? Those already have the correct role by default.
I agree with @jessarcher, just using the |
Whats the status on this PR? it fixes the issue with the ARIA warning on build in #1627 |
This PR seems to have stalled as the OP isn't answering anymore. It's best that someone else picks up the work in a new PR. |
I can take this one. I am struggling right now with this issue, so I can make the changes proposed by the original author. |
We'd welcome a new PR for this. Thanks |
Decided to fix this using a |
#1627