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

Fix immediately dismissing popovers on iOS. #1893

Merged

Conversation

kevin1
Copy link
Contributor

@kevin1 kevin1 commented May 15, 2024

#57

I believe this bug happens because littlefoot handles both touchend and click event types with the same handler. On iOS and possibly other touch browsers, both events could be delivered each time the user taps the screen. The best practice is to call event.preventDefault() when handling the touch event to prevent the subsequent simulated mouse event from firing.

goblindegook#57

I believe this bug happens because littlefoot handles both `touchend`
and `click` event types with the same handler. On iOS and possibly other
touch browsers, both events could be delivered each time the user taps
the screen. The best practice is to call `event.preventDefault()` when
handling the touch event to prevent the subsequent simulated mouse event
from firing.
@goblindegook
Copy link
Owner

Thanks for this! Would you be able to cover this behaviour with a test to prevent regressions?

@kevin1
Copy link
Contributor Author

kevin1 commented May 16, 2024

I've added a test. I think the best I can do is test the touch event's defaultPrevented value to ensure the preventDefault line isn't removed in the future. There isn't a great way to simulate mouse events from a touch — I think we would need a real mobile browser for that.

@goblindegook goblindegook merged commit 98fd2d3 into goblindegook:main May 16, 2024
@goblindegook
Copy link
Owner

Thanks for your fixes! I'll be making a release soon.

@kevin1 kevin1 deleted the mobile-safari-immediate-dismiss branch May 16, 2024 22:44
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 this pull request may close these issues.

None yet

2 participants