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

[Menu] Dropdown + onMouseOver => Dropdown open forever #16651

Closed
2 tasks done
romainquellec opened this issue Jul 19, 2019 · 8 comments
Closed
2 tasks done

[Menu] Dropdown + onMouseOver => Dropdown open forever #16651

romainquellec opened this issue Jul 19, 2019 · 8 comments
Assignees
Labels
new feature New feature or request priority: important This change can make a difference

Comments

@romainquellec
Copy link

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

When I use a Menu like a Dropdown with onMouseOver, when I dont go on the dropdown, the dropdown doesnt close by itself (see example)

Current Behavior 😯

Well, I said everything already. Maybe, I've done something wrong, but I dont see how to do it with my current knowledge of mui.

Steps to Reproduce 🕹

https://codesandbox.io/s/material-demo-nbki0

If you mouseover the button and go left without touching the dropdown, the dropdown will be open forever. How to fix that simply ?

Tech Version
Material-UI v4.2.1
React 16.8.6
@oliviertassinari oliviertassinari added priority: important This change can make a difference new feature New feature or request labels Jul 19, 2019
@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 19, 2019

@romainquellec Thanks for opening this issue. I think that it's a use case we should support natively. Triggering an action on a hover event is often not a great idea. The purpose of a hover state is to indicate something is clickable or to provide quick information, e.g. tooltip. The click should be reserved for doing actions. But they might be cases where it's valid.

I think that this issue highlights our lack of a good dropdown story for the library.

@romainquellec
Copy link
Author

You're welcome !

Do you suggest I wait for a component ? Have you a quick fix in mind ?

@eps1lon
Copy link
Member

eps1lon commented Jul 24, 2019

I'm missing the connection between the demo and the initial statement. For dropdowns we have the Select component.

The issue with the demo is that you mouseout of the window and you get in this weird limbo where you never actually moused out. We can probably fix the onClose logic but it's not related to dropdown menus.

Could you record a video with the interaction you wouldn't expect? Best in a more isolated environment i.e. not directly at the edge of the screen.

@eps1lon eps1lon self-assigned this Jul 24, 2019
@romainquellec
Copy link
Author

romainquellec commented Jul 25, 2019

Well, no.
You can try with this if you want, but I think the issue is pretty clear. ( https://codesandbox.io/embed/material-demo-huq5z )

  1. MouseIn on the Button
  2. Leave the Button NOT by the Menu
  3. Menu still open

I choose this way of doing following some issues about dropdown (#10804)
Now, I know a dropdown component will eventually come, and maybe, there is no good way of doing this, and I'm OK with this. (I will just wait for the component)

If you know a better way of doing a dropdown, or if I did something wrong, just just tell me, but, again, this issue seems pretty clear to me.

@romainquellec
Copy link
Author

romainquellec commented Jul 25, 2019

Alternative I found : https://jcoreio.github.io/material-ui-popup-state/ here (#9893)

@eps1lon
Copy link
Member

eps1lon commented Jul 25, 2019

Now, I know a dropdown component will eventually come, and maybe, there is no good way of doing this, and I'm OK with this. (I will just wait for the component)

A dropdown is already implemented in https://material-ui.com/components/selects/#simple-select or with less boilerplate https://material-ui.com/components/text-fields/

In your demo I only see a menu that should open on hover. That's a bit more tricky to achieve since we have to deal with the backdrop and what should happen when I click on the button when the menu is open. You're probably better of implementing this with a Popper. The Popover is a more disruptive UI that's not very well suited for mouseover interactions.

So I would either recommend subscribing to #9893 or ask on SO/spectrum how to implement a menu that opens on hover.

@eps1lon eps1lon closed this as completed Jul 25, 2019
@romainquellec
Copy link
Author

"A dropdown is already implemented". To be clear, to me :

A dropdown is not a select. (Maybe, you call that a Menu)
Dropdown is an "overlay" for displaying a list of links

A Select is an "overlay" that allow a user to select a value from a series of options (in a form)

@ow-tech
Copy link

ow-tech commented May 29, 2023

Facing pretty much the same issue. Though in my use case, am having a selection with menu items as options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request priority: important This change can make a difference
Projects
None yet
Development

No branches or pull requests

4 participants