Skip to content

Cursor jumps to end of search params bound input #3162

Open
@Nick-Lucas

Description

Which project does this relate to?

Router

Describe the bug

It's common to bind a Filter input to search params so that URLs can be shared, and a user should be able to type anywhere in the input and it behave predictably.

Current behaviour of this isn't predictable though, if you type into the end of an input it behaves fine, but if you type into the middle, the cursor jumps to the end.

I suspect this is because startTransition is called by default under the hood now, but there doesn't appear to be a way to disable this behaviour or any past github issue which describes a workaround or fix

Your Example Website or App

Example project: search-validator-adapters

Steps to Reproduce the Bug or Issue

  1. Boot up the search-validator-adapters example project
  2. Navigate to a tab (I like the zod one 😉)
  3. Type some text into the input
  4. Change cursor position to middle of the text
  5. type 1 character
  6. the cursor jumps to the end 😱

Expected behavior

Typing anywhere in the input types where your cursor is and retains cursor position

Screenshots or Videos

Image

Platform

  • OS: Mac and Windows
  • Browser: Chrome (tested)

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions