Fix DND not working in field groups and any other component where children are not rendered inside the first DOM node

This commit is contained in:
Andrew Kingston 2022-10-14 19:34:23 +01:00
parent 622553978b
commit 011ba26769
1 changed files with 8 additions and 0 deletions

View File

@ -123,6 +123,14 @@
return return
} }
// As the first DOM node in a component may not necessarily contain the
// child components, we can find to try the parent of the first child
// component and use that as the real parent DOM node
const childNode = node.getElementsByClassName("component")[0]
if (childNode?.parentNode) {
node = childNode.parentNode
}
// Append an ephemeral div to allow us to determine layout if only one // Append an ephemeral div to allow us to determine layout if only one
// child exists // child exists
let ephemeralDiv let ephemeralDiv