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

user.click (or user.pointer) does not trigger a 'click' event if 'pointerdown' event handling calls event.preventDefault() #1206

Open
turjmner8 opened this issue Apr 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@turjmner8
Copy link

Reproduction example

N/A

Prerequisites

Use the user.click or user.pointer API to simulate a 'click' gesture on an element that has its own 'pointerdown' and 'click' event handlers setup.
Call 'event.preventDefault()' in the pointerdown event handling.
Notice that the element's 'click' event handler will not be triggered.

Doing the same without the 'event.preventDefault()' call will result in the 'click' event handler being triggered. In a real browser environment though, calling 'event.preventDefault()' should not prevent an eventual 'click' event from being triggered on an element.

Expected behavior

'click' event handling should be triggered due to the user.click() API call regardless of preventDefault call during previous 'pointerdown' event handling.

Actual behavior

'click' event handling is only triggered when previous 'pointerdown' event handling does not call event.preventDefault()

User-event version

14.0.0

Environment

Testing Library framework:

JS framework:

Test environment:

DOM implementation: Using real browser testing in Chrome on Mac. It does not seem like 'pointerdown' events are simulated properly using Jest.

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants