You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering an issue when trying to sync a controlled input directly with the URL parameters.
The Issue: When driving an input value from searchParams.get('key') and updating it via setSearchParams on every keystroke, the input cursor jumps to the end of the string. I noticed that this actually works correctly on Firefox, but the issue persists in other browsers (like Chrome).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am encountering an issue when trying to sync a controlled input directly with the URL parameters.
The Issue: When driving an input value from searchParams.get('key') and updating it via setSearchParams on every keystroke, the input cursor jumps to the end of the string. I noticed that this actually works correctly on Firefox, but the issue persists in other browsers (like Chrome).
Reproduction: You can see the behavior in this CodeSandbox: https://codesandbox.io/p/devbox/crazy-franklin-forked-p8vg6s?file=%2Fapp%2Froot.tsx%3A13%2C50&workspaceId=ws_JQzt9iQGP6dfyuPZzFjHxj
Is this expected behavior, or is there a specific workaround I should be using?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions