Преглед изворни кода

fix(dashboard): Fix position of bulk actions when in sheet

Michael Bromley пре 4 месеци
родитељ
комит
2902e3037d
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      packages/dashboard/src/lib/hooks/use-floating-bulk-actions.ts

+ 3 - 1
packages/dashboard/src/lib/hooks/use-floating-bulk-actions.ts

@@ -32,7 +32,9 @@ export function useFloatingBulkActions({
         }
         }
 
 
         const updatePosition = () => {
         const updatePosition = () => {
-            const container = document.querySelector(containerSelector)?.closest('div') as HTMLElement;
+            // Find the container by searching upwards from the current component
+            const currentElement = document.activeElement || document.body;
+            const container = currentElement.closest(containerSelector) as HTMLElement;
             if (!container) return;
             if (!container) return;
 
 
             const containerRect = container.getBoundingClientRect();
             const containerRect = container.getBoundingClientRect();