Browser-specific contenteditable behavior requires careful handling
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.
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
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:
https://svelte.dev/playground/61c8e36e179a4a5aad34d3736e919ee9?version=latest
Svelte version: 5.54.0
annoyance
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!