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

when using onInputChange/inputValue, cursor is positioned to the end of the input field on each keystroke #5942

Open
scramjet opened this issue Aug 8, 2024 · 0 comments
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet

Comments

@scramjet
Copy link

scramjet commented Aug 8, 2024

This is on react-select v5.8.0.

My onInputChange handler is storing the text in a local var, inputValue is being provided as prop. If you position the cursor inside the input text, and type a character the cursor jumps to the end.

I am doing this, because in certain situations I want to programmatically modify the input text.

One solution would be for the control to remember the text cursor location when updating the text from the prop and restore afterwards.

Another solution, which is not complete but would cover a lot of it, would be simply to do nothing if inputValue is the same as the current text in the input element.

@scramjet scramjet added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet
Projects
None yet
Development

No branches or pull requests

1 participant