-
Notifications
You must be signed in to change notification settings - Fork 251
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
refactor: dispatch all UI events per one internal API #838
Conversation
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 bf734dc:
|
Codecov Report
@@ Coverage Diff @@
## beta #838 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 81 85 +4
Lines 1705 1736 +31
Branches 618 619 +1
=========================================
+ Hits 1705 1736 +31
Continue to review full report at Codecov.
|
6272b65
to
3fdb31f
Compare
7a826e1
to
52da1fc
Compare
🎉 This PR is included in version 14.0.0-beta.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
Dispatch user events per one central internal API.
This allows to consistently apply workarounds on the event handling.
Why:
userEvent.upload
does not honor event handlers on theclick
event.When trying to write a quick fix for this, I discovered that the problem runs deeper.
The trusted UI events by the user trigger a default behavior, but there is also a default behavior for programmatically dispatched events.
Because the latter is executed instantly if no event handler calls
event.preventDefault()
, any default behavior we simulate trails the programmatically triggered default behavior. This leads to event handlers for the latter observing the wrong document state.Also some default behavior (like opening the file dialog) depends on event handling that is automatically triggered (clicking a label dispatches a click on the control), but this event is not observed by our implementation.
How:
Refactor how events are created and dispatched.
Checklist: