Ask questionsBug: cursor jumps to end of controlled <input> tag when value is modified
React version: 16.13.1
<input>tag controlled, by setting its
valuein response to
Link to code example:
Adapted from CodePen example (https://codepen.io/gaearon/pen/VmmPgp?editors=0010) on https://reactjs.org/docs/forms.html
If the transformation changes the value, the cursor is moved to the end of the input.
Cursor should remain at the original position if possible (this is the behaviour of the
TextInput component in React Native).
Answer questions vkurchatkin
But React doesn't provide that low-level access (by design).
Well, that's where you are wrong. It's not that hard to implement this in React. Here is a demo: https://codesandbox.io/s/boring-dirac-utq82