refactor: dispatch all UI events per one internal API#838
Merged
ph-fritsche merged 4 commits intobetafrom Feb 3, 2022
Merged
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
2 tasks
|
🎉 This PR is included in version 14.0.0-beta.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
Dispatch user events per one central internal API.
This allows to consistently apply workarounds on the event handling.
Why:
userEvent.uploaddoes not honor event handlers on theclickevent.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: