Shopify / draggable

The JavaScript Drag & Drop library your grandparents warned you about.
https://shopify.github.io/draggable
MIT License
17.93k stars 1.09k forks source link

Do not set fixed (possibly duplicate) ID #541

Closed mvorisek closed 1 year ago

mvorisek commented 1 year ago

introduced in https://github.com/Shopify/draggable/pull/102, the div can exists multiple times with the same ID in the DOM

please merge & release asap, this problem is failing our CI where we assert no duplicate ID across all tested pages

mvorisek commented 1 year ago

reproducible on https://dev.agiletoolkit.org/demos/interactive/jssortable.php demo

image

maybe ID is fine, but the announcements div should be added only once, even if new Draggable.Sortable is called more than once (once per UI component, but we can have more components of course)

@tsov you are the author of the original PR, can you please look at this problem?

mvorisek commented 1 year ago

the problem seems to be https://github.com/Shopify/draggable/blob/05498d3f74d6f8147608799a2f63f9a245235b73/src/Draggable/Plugins/Announcement/Announcement.js#L177 is called more than once - https://stackoverflow.com/questions/6261966/domcontentloaded-only-once

mvorisek commented 1 year ago

no reaction