-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[TextField] Cursor position on Chrome after server-side rendering #23096
Comments
Thanks for the report 👍
This is indeed the behavior for native inputs on pristine inputs. But once the select range changes, clicking the label restores the range. Restoring is already working with Material-UI inputs. It's just that the range is different for pristine inputs. Though it might be caused by something different (e.g. controlled vs uncontrolled?). Either way, we need to identify what is responsible for changing the selection range. The actual label-click behavior is working correctly. |
This comment has been minimized.
This comment has been minimized.
The point is not to force a particular behavior but try to avoid changing the selection range on pristine text fields. We could never reproduce nor we should we override native behavior. |
It looks like an issue with our documentation, not the component itself. The behaviors are identical on https://codesandbox.io/s/angry-tdd-fh4qq?file=/src/App.js. |
Interesting. The demo cloned in codesandbox works correct as well. I also tried https://material-ui.com/components/text-fields/#form-props in an incognito window and had the same issue (suspecting it was auto-fill related). |
It has something to do with the server-side rendering. NoSsr changes the outcome. |
I think that we can close, it looks like the native behavior: same on https://getbootstrap.com/docs/4.5/components/forms/#server-side. |
Yes! There's a difference between Related react issues: facebook/react#18404, facebook/react#14904, facebook/react#12762 This is best raised against the React repo. The correct behavior would be to not modify the selection and keep the cursor at the start for mounted inputs. So the opposite of what you would expect. |
@eps1lon @oliviertassinari Thanks for taking the time to check this out and for the info about SSR. |
Current Behavior 😯
When clicking the label of an input that has a value, the input's cursor will appear at the beginning of the value. A second click/action is required to move the cursor to the end of the value to edit it.
Expected Behavior 🤔
When the label of a field is clicked, the input's cursor should default to the end of the value, if one exists.
Steps to Reproduce 🕹
Steps:
Context 🔦
We're using Material UI inputs for all of our forms, and are looking to make editing behavior as consistent as possible.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: