-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
A11y: noninteractive element cannot have positive tabIndex value when using tabindex="0" #7953
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
Comments
I can reproduce this in 3.52.0. It's coming from #6693. @tanhauhau since you merged this, do you have an opinion about it? The message says "positive tabindex values" but the check in the code is for |
In case this rule is working as intended, I'd be curious how your supposed to make a list tabbable without using
|
@Conduitry all a11y rules are based on eslint-plugin-jsx-a11y, and this particular rule comes from https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-tabindex.md adding an interactive @janosh also according to the eslint-plugin-jsx-a11y, It is not necessary to put a tabindex on an , for instance or on |
Yeah, I saw that. But my use case is non-assistive. I want to be able to tab-traverse list items myself. It's for this ToC component: https://svelte-toc.netlify.app.
Thanks.
|
Honestly, it doesn't matter what eslint-plugin-jsx-a11y says, it's a poorly worded, misleading warning... When did 0 become a positive number? |
@charbelnicolas It's debatable. I mostly agree with your stance but in mathematics, people often use positive to include zero and the term "strictly positive" when they want to exclude it. |
This rule is also triggered in a number of situations, for example when Repro: https://svelte.dev/repl/0bd4ce269ee64d48a51929a95be6d6e7?version=3.53.1 I would add a role to indicate interactivity, but I don't know of one that represents a draggable or droppable area. |
In my case, I have a noninteractive element with a tooltip. I want the tooltip to open when a sighted user tabs to the element. The element should not have an interactive role, as it is only informational. Screen reader users will get the same information that is provided in the tooltip. So it doesn't make sense to use an interactive element or role like Tabbing isn't only for screen reader users. |
Also getting this warning, and good accessibility is important. Given a very long list of searchable items where the user can select one option, would the correct schematics be something like this? <ul role="radiogroup">
<li role="radio"
tabindex="0"
aria-checked="false/true"
on:click={select}
on:keyup={select}>
<!-- content -->
</li>
</ul> (Given select() handles mouse and keyboard event.key === 'Enter') Previously not been using Was thinking the default |
Describe the bug
I don't really know where to post this bug but I keep getting the same warning when using tabindex="0":
If you know where I should report this bug, let me know!
Reproduction
Add a tabindex="0" to any div element and see for yourself :)
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: