-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
tabIndex doesn't work for values more than 0 #2643
Comments
This is by design, and matches web accessibility recommendations https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex |
|
@gentlee I agree that we should have the ability to set I don't think it make sense to enforce (without workaround) best practices like this at the RNW layer. I do think it's a good idea to help devs make the right choices though. We could make it more clear that it should be avoided or treat it as an advanced feature by adjusting the API. Also could be worth providing warning messages or adding a linter to the default preset to raise awareness when setting tabindex > 0. Some ideas for an API that communicates more than just the numerical value of the field: tabIndex={true} // "focusable" -> 0
tabIndex={false} // "not focusable" -> -1
tabIndex={TabIndex.DEFAULT} // "focusable" -> 0
tabIndex={TabIndex.HIDDEN} // "not focusable" -> -1
tabIndex={TabIndex.PRIORITY} // "focusable" -> 1
tabIndex={TabIndex.value(2)} // "focusable" -> 2 For the For our use-case, we have a page with some header elements and then a list view with thousands of entries and a sticky footer button that we want to have tab priority above the list so that users can tab to it without having to go through all the entries. If there is another way to accomplish this, that would be great to know! |
I don't think this should be "fixed" in react-native-web and just use the values as-is. If a developer wants to use any other value than -1 or 0 leave it up to them. Now we are forced to use an opinionated value to tabIndex |
Is there an existing issue for this?
Describe the issue
tabIndex works only when it is set to value -1 or 0.
Expected behavior
tabIndex should behave the same as for corresponding html tag - work with values from - 1 to 32767.
Steps to reproduce
Pass
tabIndex={999}
to any component, this attribute won't appear in html.Test case
Additional comments
Needed when for example I want to move header back button to the end of focus order.
The text was updated successfully, but these errors were encountered: