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(onClickOutside): fallback to pointerup event if click event not propagate #1522

Merged
merged 1 commit into from May 3, 2022

Conversation

sibbng
Copy link
Member

@sibbng sibbng commented Apr 23, 2022

Fix #1520

Description

This article from 2014 clearly explains what is going on there. This PR simply workaround this issue by falling back to pointerup event.

click event is fired after all release events (mouseup, touchend, pointerup). So, if click event is propagated normally within 50ms, timeout will be cleared. Initially, I was thinking to use touchend event. But the type of touchend event is not compatible with PointerEvent.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@antfu antfu changed the title fix: fallback to pointerup event if click event not propagate fix(onClickOutside): fallback to pointerup event if click event not propagate Apr 23, 2022
@antfu antfu merged commit 89c9e53 into vueuse:main May 3, 2022
@sibbng sibbng deleted the fix/onclickoutside-safari-workaround branch May 4, 2022 04:26
@hminghe
Copy link

hminghe commented Jun 6, 2022

event.composedPath() expires after setTimeout

@sibbng
Copy link
Member Author

sibbng commented Jun 6, 2022

event.composedPath() expires after setTimeout

It seems shouldListen variable covered us here. So it should function as expected except ignore option. Could you create new issue with reproduction?

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.

onClickOutside not working on Safari iOS
3 participants