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(number-editor): use "text" input that syncs numeric value when valid #1020

Merged
merged 5 commits into from
Feb 14, 2022

Conversation

denkristoffer
Copy link
Contributor

Due to browser implementations, React is unable to fully control inputs of type="number": facebook/react#6556

This commit changes NumberEditor to type="text" to avoid these issues. We keep a local string input value that we then convert to a number when it's actually valid.

Due to browser implementations React is unable to fully control inputs of `type="number"`.
This commit changes `NumberEditor` to `type="text"` to avoid these issues. We keep a local string
input value that we then convert to a number when it's actually valid.
@denkristoffer denkristoffer requested a review from a team as a code owner February 10, 2022 18:18
@denkristoffer denkristoffer requested review from gui-santos and bgutsol and removed request for a team February 10, 2022 18:18
@netlify
Copy link

netlify bot commented Feb 10, 2022

✔️ Deploy Preview for contentful-field-editors ready!

🔨 Explore the source changes: 691a876

🔍 Inspect the deploy log: https://app.netlify.com/sites/contentful-field-editors/deploys/620a67e49851630007009022

😎 Browse the preview: https://deploy-preview-1020--contentful-field-editors.netlify.app

@denkristoffer denkristoffer requested a review from a team February 14, 2022 09:19
packages/number/src/parseNumber.ts Show resolved Hide resolved
packages/number/src/NumberEditor.tsx Outdated Show resolved Hide resolved
@denkristoffer denkristoffer merged commit 0f38462 into master Feb 14, 2022
@denkristoffer denkristoffer deleted the fix-number-editor branch February 14, 2022 16:04
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.

2 participants