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: synchronize focused email input on blur to avoid check validity when inputting #19621

Closed
wants to merge 3 commits into from

Conversation

jameslahm
Copy link

@jameslahm jameslahm commented Aug 15, 2020

Summary

Fix #19563, similar to #7253. The reproduce shows that the cursor will skip to the beginning position of the email input when delete with backspace. The cause is that node.defaultValue will be set to the node.value when inputting, which triggers validation on the email input and make the cursor skip to the beginning position in blink. So similar to focused number input #7359, synchronize focused email input on blur, which should works.

Test Plan

The reproduce show it works

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 15, 2020

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

Sandbox Source
React Configuration
React Cursor Jumps To Start of Input For Input Type Email PR
React Cursor Jumps To Start of Input For Input Type Email Issue #19563

@sizebot
Copy link

sizebot commented Aug 15, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against d6d1193

@sizebot
Copy link

sizebot commented Aug 15, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against d6d1193

@gaearon
Copy link
Collaborator

gaearon commented Aug 17, 2020

Thanks for the PR.

Turns out we already had this fix in #18379 and I reverted in #18459 because it's a behavior change and a bit risky without thorough testing. We want to keep changes in 17 minimal so this would be better to do in 18.

That said, I'm also hearing this is being fixed in Chrome: #15418 (comment).

@gaearon gaearon closed this Aug 17, 2020
@gaearon
Copy link
Collaborator

gaearon commented Aug 17, 2020

(I'm closing because we can reapply the past PR once we're comfortable with the change)

@jameslahm
Copy link
Author

Thanks for the reply, get it.

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.

Bug: Cursor of controlled input of type email jumps to the beginning of input while deleting
4 participants