Skip to content

fix: cursor jumps in input two way binding #16649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

fabhari
Copy link

@fabhari fabhari commented Aug 19, 2025

Old Fix: Restore input binding selection position (#14649) .
Current Fix: Remove unnecessary cursor manipulation written for (#14649) as the presence of runes no longer requires special handling.

This fix closes #16634

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Hariharan Srinivasan added 2 commits August 20, 2025 00:20
Old Fix: Restore input binding selection position (sveltejs#14649)
Current Fix: Remove unnecessary cursor manipulation as the presence of runes no longer requires special handling.
Copy link

changeset-bot bot commented Aug 19, 2025

🦋 Changeset detected

Latest commit: f8f2a3d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@16649

@fabhari fabhari changed the title Bug/input two way binding Fix : cursor jumps in input two way binding Aug 20, 2025
@fabhari fabhari changed the title Fix : cursor jumps in input two way binding fix : cursor jumps in input two way binding Aug 20, 2025
@fabhari fabhari changed the title fix : cursor jumps in input two way binding fix: cursor jumps in input two way binding Aug 20, 2025
@7nik
Copy link
Contributor

7nik commented Aug 20, 2025

This breaks a case like this (compare to the latest version)

<input bind:value={() => name, v => name = v.toUpperCase()} />

To elaborate: the input and the variable get desynced.

Hariharan Srinivasan added 3 commits August 22, 2025 00:02
Introduced Promise.resolve to ensure that the 'set' operation completes before the 'get' operation Minimizing update delays.
@fabhari
Copy link
Author

fabhari commented Aug 22, 2025

Hey @7nik Thanks for highlighting that.
hope have fixed the issue by syncing the set and get operations using promises. tested it with a few cases, but if you come across any other failed tests, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two way binding to a property of an object in an array update is delayed
2 participants