mirror of https://github.com/artf/grapesjs.git
Browse Source
DropLocationDeterminer#getMouseTargetElement resolved the drop target with `containerContext.document.elementFromPoint()`. `Document.elementFromPoint` does not pierce shadow boundaries, so when a sorter container lives inside a shadow root it returned the shadow host instead of the hovered item. The subsequent `getFirstElementWithAModel` walk is bounded by `containerContext.container.contains(el)`, which is false for the host, so it returned null and handleMove bailed out on every sample: no placeholder, no drop, silent failure. This hits the Layer Manager when rendered into the host page via `layerManager.appendTo` (ItemsView hardcodes `document: document`), making layer reordering a no-op. The canvas is unaffected because its containerContext document is the iframe document. Fix: run the hit-test on `container.getRootNode()`, which is the ShadowRoot when the container is in a shadow tree and the Document otherwise. `ShadowRoot` implements the same DocumentOrShadowRoot mixin and resolves within its own tree, so behaviour outside shadow DOM is unchanged; the isFunction guard falls back to containerContext.document for a detached container. Introduced by the sorter refactor in #6149 (0.22.1), which replaced the previous `e.target` lookup — not retargeted for a listener inside the same shadow tree. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>pull/6824/head
1 changed files with 17 additions and 2 deletions
Loading…
Reference in new issue