Feature Request: Skip keyboard navigation of disabled options #4636
Replies: 10 comments 3 replies
-
I was looking into this and there's actually a test that verifies disabled options to be focusable. I was wondering if this is really the expected behaviour because the native element skips disabled options. It would be nice to give the user the ability to control skipping vs not skipping as we have a requirement to skip the disabled ones. Edit: Looks like this was intended to apply accessibility to disabled options: #3445 |
Beta Was this translation helpful? Give feedback.
-
In my opinion focusing the disabled option provides no benefit. You can focus the option, but you cannot do any actions with it. It's just adds additional action for user to press arrow key one more time to move to other option. If it is intended, I believe just like @luke-webdev mentioned it would be great to have an additional prop to allow or ignore focusing disabled options. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option#attr-disabled for example here, it is mentioned that browsers will ignore even the focus related stuff. So when you try, and see that it ignores, automatically you would expect to have same behavior here. |
Beta Was this translation helpful? Give feedback.
-
My proposal is to add a I can work on creating a pull request for this issue if this is okay. |
Beta Was this translation helpful? Give feedback.
-
i wonder if there is an option to make disabled option not only selectable/unselectable but also clickable/unclickable... thus the disabled options will have they own class and will be visual recognisable as disabled but users will be able to click them.. |
Beta Was this translation helpful? Give feedback.
-
Jumping in to confirm this issue. Happy to take this on with some guidance from more experienced maintainers. |
Beta Was this translation helpful? Give feedback.
-
@ramraphael There is an open pull request for this issue, that is waiting to be merged. Can someone with write access complete it please? |
Beta Was this translation helpful? Give feedback.
-
Having the same issue |
Beta Was this translation helpful? Give feedback.
-
Greetings @audriusnavickasDB and all, The topic of disabled options been discussed before. To be clear, the functionality was originally changed to the existing behavior in order to properly support accessibility and not the other way around. #3354 Regarding native select behavior, here is your own example when arrowing down to a disabled option with VoiceOver enabled: It's reasonable to say that This criteria likely disqualifies this as a candidate for inclusion into a future release. Please not that it is a difficult balance to add new features that people have put the time into developing and testing vs the added complexity and code weight of adding and supporting a new prop. I defer to the argument that this library is not meant to be everything to everyone but rather to provide the tools to be anything to anyone. With that said, I would be open to discussing how a developer might be able to implement this functionality without changing the source code and using the existing apis. If there are gaps, we can explore adding some more universal api methods that would be beneficial to a larger group of developers. One such feature might be an internal method such as |
Beta Was this translation helpful? Give feedback.
-
Hi @ebonow 🙂 Thanks for the detailed feedback 🙂 Although I agree that it's important for react-select to be accessible, it seems that native For example, for the code below, if the user presses the down arrow key while Option 1 is selected, then Option 2 will be selected. "Disabled option" is skipped entirely. <select>
<option>Option 1</option>
<option disabled="disabled">Disabled option</option>
<option>Option 2</option>
</select> Given this, my personal thoughts are:
Thanks again, and would you to hear your thoughts on the above, when you have time 🙂 |
Beta Was this translation helpful? Give feedback.
-
@Bosch-Eli-Black thanks for the thoughtful reply. My testing for accessibility was done with OSX Voice Over activated which may explain why your experience does not match with what is shown in the screenshot as I do recall that Voice Over had to be enabled to impact the behavior of how disabled options are handled with arrow keys. This type of walled garden OS level conditional behavior makes it difficult/impossible for open source libraries like react-select to emulate so it does come down to having to make a choice (either within the library or by the dev), but I fully agree that We do have a dedicated team of people who will be looking further into accessibility. I took a shot at trying to improve many facets of the aria-live implementation, but lacked the time and resources to do a more comprehensive look into what works for different accessibility tools on different OS's. There is an argument to be made in emulating the behavior of a select for the +99% of the users who do not rely on assistive technology as ultimately we are here to support a user's experience and expectations, so I think it is worth keeping this open though this likely belongs in the Discussions area so we can focus on resolving issues here. |
Beta Was this translation helpful? Give feedback.
-
Current results:
isOptionDisabled
prop is present, it disables all selecting option value events (click, keyboard), but does not skip it's focus via keyboard when clicking arrow keys up and down.Expected results:
Beta Was this translation helpful? Give feedback.
All reactions