Skip to content

Text Duplication on contenteditable on svelte:element #17969

@reinhard-sanz

Description

@reinhard-sanz

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: #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions