-
Notifications
You must be signed in to change notification settings - Fork 248
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
fix(paste): skip input according to defaultPrevented
#862
fix(paste): skip input according to defaultPrevented
#862
Conversation
The paste event will now ignore default behavior if `event.preventDefault` is called on the paste event. Closes testing-library#861
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 1a45005:
|
Codecov Report
@@ Coverage Diff @@
## beta #862 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 82 83 +1
Lines 1717 1721 +4
Branches 614 615 +1
=========================================
+ Hits 1717 1721 +4
Continue to review full report at Codecov.
|
defaultPrevented
Co-authored-by: Philipp Fritsche <[email protected]>
Co-authored-by: Philipp Fritsche <[email protected]>
Co-authored-by: Philipp Fritsche <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for taking the time to contribute to this project ❤️
Any idea when this PR is going to be merged and a new package released? As far as I can tell, there is no workaround(s) at the moment for this issue and is therefore needing much complicated tests to achieve something simple. |
@all-contributors add @Gudahtt bug, code |
I've put up a pull request to add @Gudahtt! 🎉 |
🎉 This PR is included in version 14.0.0-beta.12 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
The paste event now uses the central event dispatching system introduced in #847 to implement the effects of the
paste
event, which ensures the effects are skipped ifevent.preventDefault
is called.Why:
This ensures that the effect of the
paste
event is ignored ifevent.preventDefault()
is called on the paste event. This matches the behavior of the paste event in the browser, and is necessary to test sites that rely on this behavior. This fixes #861.How:
The behavior of the
paste
event (which is to insert the clipboard content into the current context if it is editable) has been moved from thepaste
module to a separate module in thebehavior
directory. This effect of pasting is now called by the event dispatching system, which also ensures this effect is suppressed ifevent.preventDefault
is called.Checklist: