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

Use onMouseDown instead of onClick #113

Closed
wants to merge 1 commit into from
Closed

Conversation

kantuni
Copy link
Contributor

@kantuni kantuni commented Jun 27, 2023

Unfortunately, the code provided in Dropdown.elm doesn't work as expected.

If you try to select an item, you'll notice that the only thing that is being called is the onBlur handler. The reason behind this is that the blur event precedes the click event (which internally calls mousedown and mouseup). When the blur event is called, the menu along with its items gets destroyed, thus eliminating the onClick handler.

One solution is to replace onClick with onMouseDown. Although it gets the job done, the UX is not ideal (especially when considering a11y). Since this tutorial is just for demo purposes, I believe it's okay to make this sacrifice.

@netlify
Copy link

netlify bot commented Jun 27, 2023

Deploy Preview for elm-land ready!

Name Link
🔨 Latest commit 787b9a6
🔍 Latest deploy log https://app.netlify.com/sites/elm-land/deploys/649a5fccc519ca0008473f43
😎 Deploy Preview https://deploy-preview-113--elm-land.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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

Successfully merging this pull request may close these issues.

None yet

2 participants