Skip to content
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

[DropdownMenu] first item is sometimes selected when opening menu #540

Closed
benoitgrelard opened this issue Mar 8, 2021 · 0 comments · Fixed by #541
Closed

[DropdownMenu] first item is sometimes selected when opening menu #540

benoitgrelard opened this issue Mar 8, 2021 · 0 comments · Fixed by #541
Labels
Type: Bug Confirmed bug

Comments

@benoitgrelard
Copy link
Collaborator

benoitgrelard commented Mar 8, 2021

Bug report

Current Behavior

When using side === 'bottom' and sideOffset === 0 and no padding anywhere (basically if the first item is flush with the trigger), the first item sometimes gets selected after clicking on the trigger towards the bottom of it.

Expected behavior

It shouldn't get selected.

Reproducible example

https://codesandbox.io/s/mystifying-saha-p031u?file=/src/App.js

Suggested solution

We run our onSelect on mouseup in order to be able to open and select in one fell swoop like MacOS menu/select.
It seems that perhaps the menu shows up before it's completely in place or there's some kind of timing issue.

Additional context

This issue was initially brought to our attention here: radix-ui/design-system#305

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant