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

Feature: add option to close dropdown on mousedown outside instead of full click #95

Closed
agusterodin opened this issue Oct 13, 2020 · 4 comments · Fixed by #212
Closed
Assignees

Comments

@agusterodin
Copy link

I have seen menu button dropdowns implemented both ways and understand that you want to enforce a consistent experience but would love a prop that allows us to close dropdown on mousedown instead of a full click (mouse down + mouse up) outside.

This style of behavior lends itself well to very "app-like" webapps. This is how dropdowns work at an os level or any native desktop app. I have seen this behavior in places on the web like the spotify web player and the app switcher menu at top right of gmail.

@RobinMalfait RobinMalfait self-assigned this Jan 29, 2021
@RobinMalfait
Copy link
Member

Hey! Thank you for your suggestion!
Much appreciated! 🙏

I think that an option to control it is not a good idea, I prefer consistency. That said, I think we might want to switch to just mouse down instead of a full click everywhere.
We made some decisions based on macOS behaviour (for example, Menu & Listbox options don't wrap around).
When I look at the native Menu on mac, or a native <select> html element, these also disappear on mouse down instead of a full click.
When you look at inputs, they also loose focus when you mouse down outside of the element.

@adamwathan what do you think of switching from a full click to just a mouse down for this outside click behaviour?

@adamwathan
Copy link
Member

I like the idea to just straight up switch to mouse down. If Tim does it, we do it #macOS

@RobinMalfait
Copy link
Member

TIM APPLE!

bitmoji

@RobinMalfait
Copy link
Member

This will be available in the next release.

  • You can already try it using npm install @headlessui/react@dev or yarn add @headlessui/react@dev.
  • You can already try it using npm install @headlessui/vue@dev or yarn add @headlessui/vue@dev.

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

Successfully merging a pull request may close this issue.

3 participants