Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
Live demo: https://react-use-caret-position.netlify.app
If there is some side effect/async code in an input's onChange
event handler (e.g. dispatching a Redux action without doing anything else, format text in some way like uppercase, etc), the caret will annoyingly be booted to the end of the input after each keystroke.
react-use-caret-position
fixes this undesirable behavior by keeping track of the caret position and setting it on render.
With npm...
With yarn...
Key | Type | Description |
---|---|---|
ref | React.RefObject | Ref that should be assigned to your input |
start | number | Current start position of the text selection |
end | number | Current end position of the text selection |
updateCaret | () => void | Function to set the caret position |
MIT © melanieseltzer
Thanks goes to these wonderful people (emoji key):
Aaron Ross 💻 📖 | Евгений 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!