-
Notifications
You must be signed in to change notification settings - Fork 240
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
feat(pointer)!: introduce pointerEventsCheck
option
#823
Conversation
BREAKING CHANGE: `skipPointerEvents` has been removed. Use `pointerEventsCheck: PointerEventsCheckLevel.Never` instead.
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. Latest deployment of this branch, based on commit 4b6a58e:
|
Codecov Report
@@ Coverage Diff @@
## beta #823 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 80 81 +1
Lines 1679 1701 +22
Branches 610 611 +1
=========================================
+ Hits 1679 1701 +22
Continue to review full report at Codecov.
|
@jesperorb You implemented the previous option. What do you think about this change? |
I think it is a good change. As disabling it is not the ideal solution and more granular control is good, The flag is a better solution than just a boolean. 👍🏽 As I saw in my profiling it was a combination of the click being slow but also that a click triggered a hover or some other event. Which doubled the time although the check for pointer events should be the same, the elements are the same. And this change seems to adress that so that is nice :) That said, I didn't understand everything but I think I got the gist of it. But I can't really visualize how I would use every option of the flag practically although I understand it conceptually. |
Thanks for the feedback.
|
🎉 This PR is included in version 14.0.0-beta.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
BREAKING CHANGE:
skipPointerEvents
has been removed.Use
pointerEventsCheck: PointerEventsCheckLevel.Never
instead.What:
Replace boolean
skipPointerEvents
with bit flagpointerEventsCheck
.Move pointer-events check from convenience APIs to
pointer
API.Why:
The pointer-events check had been implemented on the pointer related APIs which have one target element.
Direct calls to
pointer
didn't implement the check as thepointer
API does not necessarily have one target element. Therefore just moving or replicating the old implementation in pointer was impossible.Just adding checks wasn't feasible as we know how expensive the check can be (especially in Jsdom).
How:
Let a "trigger" be one UI interaction that possibly leads to multiple events. E.g. releasing a mouse button which can trigger
pointerup
,mouseup
,click
...Move check into
pointer
API and call it on every "trigger" on every target element.Add internal
ApiLevel
refs and reorganize the export so that multiple internal API calls from one user API call can be treated as one call.Cache the result of the pointer-events check on the element.
Allow the user to specify how often we actually perform the check or potentially use a cached result per
pointerEventsCheck
option:user-event/src/options.ts
Lines 6 to 18 in 4b6a58e
This PR includes a drive-by fix for options per main
setup
. These have been dropped before.Checklist: