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
Controlled <input type="email" /> doesn't behave like other controlled inputs #14897
Comments
@danott browser implementations of https://stackoverflow.com/questions/41955069/value-of-input-with-type-email-doesnt-contain-spaces |
@jeroenvisser101 I'm not understanding how comparing strings after I've amended the Code Sandbox above to include buttons that are outside the inputs' |
@danott ideally, the browser implementation details would not change the behavior of controlled inputs. This is just a particularly painful bug because the tools we have in the browser to deal with it are limited. For another example, assigning leading/trailing spaces on email inputs has challenges too. The input strips the whitespace on assignment: https://codepen.io/nhunzaker/pen/vbojvb Eliminating spaces on value assignment and value retrieval has been a really difficult issue to overcome. Having said that, I don't want to discount your frustration. I really want to iron this out too. Edit: particularly cases that cause strange user experience during text entry, even if we can't fully control all cases for the email input. |
No worries! I was coming more from a place of surprise rather than frustration. For my use case, the HTML5 semantics weren’t critical, so I transitioned from
As I dig into the edges of this behavior, that is ringing very true. Thanks for taking the time to help me understand, and providing additional examples. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
Do you want to request a feature or report a bug?
🐛
What is the current behavior?
Leading and trailing whitespace can remain present on a controlled
<input type="email" />
, even when the controlling value has the whitespace removed.What is the expected behavior?
Leading and trailing whitespace should not remain present on a controlled
<input type="email" />
, even when the controlling value has the whitespace removed.Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
I discovered this while using React 16.8.2 in Safari Version 12.0.2 (14606.3.4)
Here's a code sandbox that demonstrates the behavior: https://codesandbox.io/s/1ozyz1kn5l
The text was updated successfully, but these errors were encountered: