Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Text Duplication on contenteditable on svelte:element | GoodFirstPicks

Text Duplication on contenteditable on svelte:element

sveltejs/svelte 1 comments 11d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeSvelteTypeScript

Why this is a good first issue

Browser-specific contenteditable behavior requires careful handling

AI Summary

The issue involves text duplication in contenteditable elements specifically in Chrome, with a provided reproduction case. While the scope is somewhat clear (fixing the visual duplication), the solution may require understanding browser-specific contenteditable behavior and Svelte's handling of dynamic elements. The reproduction helps but browser-specific issues add complexity.

Issue Description

Describe the bug

I am getting this weird text duplication on contenteditable on svelte:elements. It's a bit hard to explain but i managed to build a reproduction, which should explain the error.

I initially though this was fixed in: https://github.com/sveltejs/svelte/pull/17853 But the issue still persists in 5.54.0

Reproduction

The reproduction has a svelte:element and a button to enable editing on the svelte element.
(IIRC contenteditable cannot be dynamic, therefore the if is needed, if this has been made possible in an update please let me know) As long as there is some text content present the bug does not occur and one can edit the text as he pleases.

To reproduce the bug you have to do the following steps:

  1. Enable Edit using the button
  2. Remove all text from the svelte:element (if not all text is removed the bug will not occur)
  3. Disable Edit
  4. Reenable Edit
  5. Start typing something
  6. See that text follows correctly in the inspect but visually the text is duplicated

https://svelte.dev/playground/61c8e36e179a4a5aad34d3736e919ee9?version=latest

Logs

System Info

Svelte version: 5.54.0

Severity

annoyance

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • browser-specific behavior
  • contenteditable quirks
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno