question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[DropdownMenu] Items that are invisible cause focus issues

See original GitHub issue

Bug 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

  1. Open the Dropdown
  2. Press the arrow down key repeatedly
  3. Verify that the last element doesn’t get focused

CodeSandbox Example

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:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
benoitgrelardcommented, May 3, 2021

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

1reaction
jportelacommented, Apr 1, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found