#2089·Sortable

[bug] lit-html: Moving HTML comments creates issue with template system

Author: JaySunSynCreated Oct 12, 2021Updated Feb 2, 2026

Describe the bug

Sortable changes HTML comments in the DOM and therefore reference points for some template systems. Some HTML template systems use HTML comments to render dynamic content. See: https://github.com/lit/lit/blob/main/packages/lit-html/src/lit-html.ts#L188

Issue: After calling destroy(), the template system can't work with the HTML anymore.

Workaround: Clear the whole HTML structure of the template and render the items again.

DOM before Sortable init:

image

DOM after Sortable init:

image

Expected behavior

The HTML comment structure keeps being intact.

Information

Not sure if this issue can ever get solved properly, but worth reporting I assumed :)