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(document): reduce impact of React@17 workaround #992

Merged
merged 2 commits into from Jul 18, 2022
Merged

Conversation

ph-fritsche
Copy link
Member

@ph-fritsche ph-fritsche commented Jul 18, 2022

What:

Apply workaround only if the element is controlled by React17.
Do not reapply cursor position if selection has been changed by user code.

Why:

Closes #971

The rollback to previous value before applying a state update in test environment is specific to React@17.

How:

Check if window.REACT_VERSION === 17 and if the __react properties exist on the element, before applying the workaround.

Checklist:

  • Tests
  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 18, 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 84c673a:

Sandbox Source
userEvent-dom Configuration
userEvent-react Configuration
sweet-sea-nm8zfb Issue #971

@codecov
Copy link

codecov bot commented Jul 18, 2022

Codecov Report

Merging #992 (84c673a) into main (77a7fa8) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #992   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           86        86           
  Lines         1837      1843    +6     
  Branches       678       683    +5     
=========================================
+ Hits          1837      1843    +6     
Impacted Files Coverage Δ
src/document/index.ts 100.00% <ø> (ø)
src/document/selection.ts 100.00% <100.00%> (ø)
src/document/value.ts 100.00% <100.00%> (ø)
src/utils/edit/input.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 77a7fa8...84c673a. Read the comment docs.

@ph-fritsche ph-fritsche changed the title fix(document): reduce impact of workaround for React@17 fix(document): reduce impact of React@17 workaround Jul 18, 2022
@ph-fritsche ph-fritsche merged commit 9816d38 into main Jul 18, 2022
@ph-fritsche ph-fritsche deleted the iss-971 branch July 18, 2022 12:07
@github-actions
Copy link

🎉 This PR is included in version 14.2.6 🎉

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot set the cursor position after programmatically modifying the value of input
1 participant