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: maintain UI value on controlled number input #889

Merged
merged 1 commit into from Mar 31, 2022
Merged

Conversation

ph-fritsche
Copy link
Member

What:

Fix how we handle programmatic vs UI changes to the value property.

Why:

Closes #886

How:

Add a workaround for Jsdom implementing the value property differently than browsers.
Fix our workaround for React's state reset and update for edge cases.

Checklist:

  • Tests
  • Ready to be merged

@codesandbox-ci
Copy link

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

Sandbox Source
userEvent-dom Configuration
userEvent-react Configuration
compassionate-sea-6ufk7l Issue #886

@codecov
Copy link

codecov bot commented Mar 31, 2022

Codecov Report

Merging #889 (cb54195) into main (f209a6f) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #889   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           84        84           
  Lines         1744      1758   +14     
  Branches       633       639    +6     
=========================================
+ Hits          1744      1758   +14     
Impacted Files Coverage Δ
src/document/selection.ts 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 f209a6f...cb54195. Read the comment docs.

@ph-fritsche ph-fritsche merged commit a7f9906 into main Mar 31, 2022
@ph-fritsche ph-fritsche deleted the fix-886 branch March 31, 2022 09:44
@github-actions
Copy link

🎉 This PR is included in version 14.0.1 🎉

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.

type() truncates numbers before the decimal point for number inputs
1 participant