[DropdownMenu] Items that are invisible cause focus issues
See original GitHub issueBug report
Current Behavior
When navigating with the arrow keys through a DropdownMenu that has hidden items (ie: with display: none
), the focus selection stops when reaching the hidden item, and as such doesn’t focus all items.
Expected behavior
The visible items are focused when pressing the arrow keys, even if there are hidden items.
Reproducible example
- Open the Dropdown
- Press the arrow down key repeatedly
- Verify that the last element doesn’t get focused
Suggested solution
Filter out the invisible items. I already have a PR ready for it (that includes a Storybook example).
Additional context
N/A
Your environment
Software | Name(s) | Version |
---|---|---|
Radix Package(s) | @radix-ui/react-dropdown-menu |
0.0.17 |
React | n/a | 17 |
Browser | Brave | |
Assistive tech | ||
Node | n/a | 14 |
npm/yarn | yarn 1.x | |
Operating System | MacOS |
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
Dropdown Causes Button To Lose Focus - Stack Overflow
I have created a drop-down menu in textAngular. When you click on something other than the text-box or one of the menu options,...
Read more >UIElements dropdown menu does not lose focus when an ...
1. Open the user's attached “UITest.zip” project · 2. Enter Play Mode · 3. Select an option in the dropdown menu (“UIDocument” GameObject)....
Read more >Drop Down Menu Focus Problem in Windows 7
Problem : When clicking on a drop down menu to see the contents of the menu, focus is lost on the menu, the...
Read more >A11y: Dropdowns have accessibility focus issues #40101
The problem is that when you activate the dropdown button, focus gets lost instead of going to the selected item in the popup....
Read more >Force DropDownList to lose focus/Blur? in UI for Blazor - Telerik
The problem is that the DropDownList doesn't have a Blur() event, and none of the Telerik Components within the page (Form, Grid, and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @jportela, the latest version has now been published and contain changes to take hidden items. https://radix-ui.com/primitives/docs/overview/releases#03052021
that’s a good alternative @benoitgrelard, thanks! Since the menu dropdown is rendered closed on the first render (server-side), there wouldn’t be a noticeable diference for users.