Skip to content
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(clipboard): prevent default behavior on copy/cut #866

Merged
merged 3 commits into from
Mar 1, 2022
Merged

Conversation

ph-fritsche
Copy link
Member

What:

Prevent default behavior per event.preventDefault():

  • writing to Clipboard on copy and cut events
  • DOM manipulation on cut

Why:

The issue described in #861 also applies to cut and copy events.

How:

Implement default input behavior for cut in event behavior system.

Keep implementation for writing to clipboard in the API (for now), because the event behavior (currently) only supports synchronous operations and writing to Clipboard is always asynchronous.

Checklist:

  • Tests
  • Ready to be merged

@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Mar 1, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 1, 2022

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 ed1c229:

Sandbox Source
userEvent-PR-template Configuration

@codecov
Copy link

codecov bot commented Mar 1, 2022

Codecov Report

Merging #866 (ed1c229) into beta (7171c9d) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              beta      #866   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           82        83    +1     
  Lines         1717      1721    +4     
  Branches       614       618    +4     
=========================================
+ Hits          1717      1721    +4     
Impacted Files Coverage Δ
src/clipboard/copy.ts 100.00% <100.00%> (ø)
src/clipboard/cut.ts 100.00% <100.00%> (ø)
src/event/behavior/cut.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7171c9d...ed1c229. Read the comment docs.

@ph-fritsche ph-fritsche merged commit 5423094 into beta Mar 1, 2022
@ph-fritsche ph-fritsche deleted the fix-cut branch March 1, 2022 12:15
@github-actions
Copy link

github-actions bot commented Mar 1, 2022

🎉 This PR is included in version 14.0.0-beta.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant