Skip to content

bind:value with function bindings don't work well with the input caret when value is changed in set #14630

@paulovieira

Description

@paulovieira

Describe the bug

Not sure if this is a bug, but it's a bit annoying.

Consider this scenario:

  • the original value from an <input type="text"> is changed in set (as in the example from the docs),
  • the caret is not at the end

Then after set is called, the caret will be positioned at the end.

The expectation here would be to have a "on-the-fly correction" of the value being typed. The caret should not change position.

Reproduction

Minimal example here: https://svelte.dev/playground/7a2879030b22491f90b27fb825076ae3?version=5.9.1

Type any lowercase letter the beginning. After that I would expect that the caret would be at second position (not at the final position)

Logs

No response

System Info

Brave.

Severity

annoyance

Metadata

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