diff --git a/src/components/ui/OutlineList .tsx b/src/components/ui/OutlineList .tsx index 091395f..a770e98 100644 --- a/src/components/ui/OutlineList .tsx +++ b/src/components/ui/OutlineList .tsx @@ -111,7 +111,7 @@ export const OutlineList: React.FC = ({ const dropAction = getDropZone(y); if (dropAction === "none") { - clearHighlight(hoveredDiv); + clearAllHighlights(); setDraggedNode(null); return; } @@ -126,7 +126,7 @@ export const OutlineList: React.FC = ({ setHierarchy(updatedHierarchy); setDraggedNode(null); - clearHighlight(hoveredDiv); + clearAllHighlights(); }; const getDropZone = (y: number): DropAction => { @@ -136,11 +136,17 @@ export const OutlineList: React.FC = ({ return "none"; }; - const clearHighlight = (el: HTMLElement) => { - el.style.borderTop = "none"; - el.style.borderBottom = "none"; - el.style.outline = "none"; - el.style.border = "none"; + const clearAllHighlights = () => { + const allNodes = document.querySelectorAll( + ".tree-node, .tree-node-content, .group-node, .dragging" + ); + + allNodes.forEach((node) => { + node.style.borderTop = "none"; + node.style.borderBottom = "none"; + node.style.outline = "none"; + node.style.border = "none"; + }); }; const removeFromHierarchy = (item: AssetGroupChild, tree: AssetGroupChild[]): boolean => {