JedWatson / JedWatson/react-select
when using onInputChange/inputValue, cursor is positioned to the end of the input field on each keystroke
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in react-select v5.8.0 using a controlled inputValue and onInputChange handler, with the cursor placed inside existing text. Trace the input update path and verify that typing preserves the cursor position while programmatic input changes still take effect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100