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

Close when clicking on parent #239

Closed
timchesney opened this issue Jun 30, 2021 · 4 comments
Closed

Close when clicking on parent #239

timchesney opened this issue Jun 30, 2021 · 4 comments
Assignees

Comments

@timchesney
Copy link

timchesney commented Jun 30, 2021

Firstly - great component, thanks!

Idea/Issue
It feels natural to be able to close the dropdown by clicking on the main element (e.g. the input) again.
Currently, doing so causes a 'flash' where the dropdown closes on mouseDown but then opens again on mouseUp.

Secondly, if you use the 'Toggle' slot for a custom toggle icon, clicking this no longer works to close the dropdown.

Solution
Either make it the default behaviour or provide an option to make clicking anywhere on the main element close the dropdown.

GIF to show what I mean

CleanShot 2021-06-30 at 14 42 58

Thanks again.

@soc221b
Copy link
Owner

soc221b commented Jun 30, 2021

Thank you for the feedback 😄 .

  1. The 'flash' issue is fixed in 58ab2bf, and released in v2.7.0, maybe you can try upgrade it.

  2. I will research for this, but since changing this behavior will introduce a breaking change I will expose a new prop to achieve different behavior.

    It feels natural to be able to close the dropdown by clicking on the main element (e.g. the input) again

  3. Did you register the click event on custom toggle slot by the exposed toggle function.

    I also noticed it works properly on button but span 😞 , I will fix it.

    You may need to add @mousedown.prevent to the slot, due to it will trigger focus event (which open dropdown before fire click event). Sorry for lack of explanation.

    if you use the 'Toggle' slot for a custom toggle icon, clicking this no longer works to close the dropdown

@soc221b soc221b self-assigned this Jun 30, 2021
soc221b pushed a commit that referenced this issue Jun 30, 2021
@timchesney
Copy link
Author

Thanks for the reply - much appreciated - hadn't used the toggle function so will give that a go... I should have read more carefully! All the best.

@soc221b
Copy link
Owner

soc221b commented Jul 1, 2021

LMK if it doesn't works 🙇‍♂️ .

@timchesney timchesney reopened this Jul 2, 2021
@soc221b
Copy link
Owner

soc221b commented Jul 10, 2021

@timchesney I noticed you reopen this issue. Does this still not work 🤔 ?

@soc221b soc221b closed this as completed Jul 25, 2021
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

No branches or pull requests

2 participants