-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
[Bug]: Clicking on a dropdown trigger twice+ times consecutively causes unexpected results #456
Comments
This behaviour is also seen in the select component: If one clicks on any of the selects more than once, on subsequent clicks the dropdown menu will appear and disappear preventing the user from being able to choose an option |
I'd be happy to investigate this and attempt to provide a PR; but would need to know, if a user clicks on a select/dropdown 2+ times, what would we expect to happen? The two contenders that come to mind are:
|
For this, I think we should close the dropdown once it is open. The issue here might have been the saving of the states of the dropdown. thank you for helping with this issue :) |
Hello @warrenspe thanks for your investigation. This is a bug and it would be awesome if you can provide a PR which would fix that. As @Jerit3787 already said, I also tend towards the first behaviour:
Looking forward to review the changes. |
I saw that there is already a PR open #452 |
Didn't test out the solution in #452 (I'm guessing it might not fix the select/label issue); but can confirm that some sort of setTimeout solution will probably be necessary due to the way handleClick/handleDocumentClick operate Clicking on the trigger calls both _handleClick and _handleDocumentClick; this can be worked around by looking at e.target, but not if a label for a select was clicked (which also calls both _handleClick and _handleDocumentClick) |
Before submitting...
Context
Noticed this when developing a navbar with a dropdown in it; clicking on the icon to open the dropdown twice would prevent the dropdown from being available to the user unless they click elsewhere
Current Behavior
If one clicks on a dropdown trigger to open the dropdown, then one or more times, on the subsequent clicks it causes the dropdown to close, open again, then immediately close.
Expected behavior
If the dropdown is currently open, clicking on the trigger should close it. If it's closed, it should open
Possible Solutions or Causes
No response
Steps to reproduce
This behaviour can be seen in the demo in the docs
https://materializeweb.com/dropdown.html#options
Click on the Left DropDown! button two or more times in a row without clicking elsewhere on the page
Your Environment
The text was updated successfully, but these errors were encountered: