Skip to content

Fix click with pointer compatibility#1121

Merged
ph-fritsche merged 5 commits intotesting-library:mainfrom
snowystinger:fix-compatibility-events
Jan 21, 2025
Merged

Fix click with pointer compatibility#1121
ph-fritsche merged 5 commits intotesting-library:mainfrom
snowystinger:fix-compatibility-events

Conversation

@snowystinger
Copy link
Contributor

@snowystinger snowystinger commented Apr 25, 2023

What:

Closes #1119
This ensures that click and double click are still fired even when preventDefault is used on pointerdown to prevent mouse compatibility events.

Why:

The browsers all work this way, as seen here https://codesandbox.io/s/aged-voice-xjf3dw

How:

Click is currently handled in the pointer/mouse class. This is fine, however there is some tracking there which tells us if we can fire the click/double click. As a result I pushed the check for isPrevented down into the mouse actions and only prevented the firing of the relevant events, not everything like it was before.

Checklist:

  • [N/A] Documentation
  • Tests
  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 25, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@ph-fritsche ph-fritsche force-pushed the fix-compatibility-events branch from b0ad70a to 3b841c0 Compare January 19, 2025 14:50
@ph-fritsche ph-fritsche merged commit f681f7b into testing-library:main Jan 21, 2025
3 checks passed
@ph-fritsche ph-fritsche mentioned this pull request Jan 21, 2025
1 task
@github-actions
Copy link

🎉 This PR is included in version 14.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@snowystinger snowystinger deleted the fix-compatibility-events branch January 21, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Click and DoubleClick not fired if pointerDown has preventDefault

2 participants