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

Should call preventDefault on touchstart events #477

Closed
markjaniczak opened this issue Sep 15, 2021 · 3 comments · Fixed by #479
Closed

Should call preventDefault on touchstart events #477

markjaniczak opened this issue Sep 15, 2021 · 3 comments · Fixed by #479

Comments

@markjaniczak
Copy link

It is not uncommon to have clickable elements underneath a modal overlay that triggers a modal close. When using the awaitCloseAnimation option, it is possible for a modal close element to move from under the cursor which can trigger a click on any element underneath it on mobile browsers that emulate click events after touchstart events.

This problem can be reproduced here on mobile or by using your browser's mobile emulator:

https://pt4fc.csb.app/

To prevent this, preventDefault should be called on the touchstart event in event handlers. MDN also suggests this to prevent emulated clicks from being heard after a touchstart event listener has already fired.

@markjaniczak markjaniczak changed the title Close on touchstart should preventDefault Should call preventDefault on touchstart events Sep 15, 2021
@Jscherbe
Copy link

Jscherbe commented Sep 23, 2021

Is this related to Stop Propagation on close?

I had an issue with the close button on top of an interactive element underneath the modal, which was getting triggered by the click of the close button

bgoewert pushed a commit to bgoewert/Micromodal that referenced this issue Nov 1, 2021
this was triggering any underlying elements
@bgoewert
Copy link

bgoewert commented Nov 2, 2021

Is this related to Stop Propagation on close?

I had an issue with the close button on top of an interactive element underneath the modal, which was getting triggered by the click of the close button

It does look like #475 is describing the same issue.

@ghosh
Copy link
Owner

ghosh commented Nov 23, 2021

Closed by 79c7595 & #479

@ghosh ghosh closed this as completed Nov 23, 2021
simonewebdesign added a commit to simonewebdesign/Micromodal that referenced this issue Nov 24, 2021
This was causing an error:

    Unable to preventDefault inside passive event listener invocation.

Essentially reverts ghosh#478.

Related to ghosh#475, ghosh#477, ghosh#479
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 a pull request may close this issue.

4 participants