-
Notifications
You must be signed in to change notification settings - Fork 929
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
[useSelect][useCombobox] Create prototype to have only useDownshift that covers both scenarios. #899
Comments
I guess a solution would be to always render the portal, regardless of the |
I think it's the fact that when we focus the menu, even though it's visually near the button, it's actually at the end of the page DOM-wise. So focus goes to the end of the page. This is my initial thought. |
If this is of any help, same example with the usage of Downshift render prop API does not scroll the page, though. |
Yeah, the focus on the list is causing your issue. If you are using Downshift / useCombobox you should get the activeDescendant value from the inputProps and use that on the toggle button, for accessibility. I will leave this issue open, as I am studying the possibility of having only one hook to cover both select and combobox. I split them due to the focus issue and some other things, but I think that I can keep focus on the toggle button and still be accessible, in both cases. Will follow up with a PR for a unified Even though the hooks are used that's fine, I think that switching between them to |
Closing in favour of moving forward with separate hooks. As part of #907 the list should not be focused anymore, functionality kept, and this bug should be fixed. |
We have experimented with keeping the focus on the button, but that breaks accessibility. If focus stays on the button, when menu is open, screen readers will not enter in Forms Mode. To conclude, the focus will stay on the list for now, as ARIA suggests in their documentation. That being said, I don't think you need a portal for that list, you can achieve the same result with CSS. Or maybe I am missing something. |
Without portal, parent elements with |
Closing this as I don't have a solution. Either use portal in scenarios scrolling at focus is not needed or try to fix it from css. Thanks for reporting it and sorry it cannot work in this case :( |
I'm just curious - does the render prop API of Downshift not keep the focus on the button then, seeing as it can work with portals without scrolling? Example: https://codesandbox.io/s/useselect-usage-kkouj?file=/index.js Thanks! |
downshift
version: 4.0.5node
version: n/anpm
(oryarn
) version: n/aWhat happened:
When it's possible to scroll the document, opening the menu scrolls to the bottom of the page, when using
useSelect
with a portal.Reproduction repository:
https://codesandbox.io/s/useselect-usage-0ifnq
The text was updated successfully, but these errors were encountered: