diff --git a/admin-spa/src/components/ui/dropdown-menu.tsx b/admin-spa/src/components/ui/dropdown-menu.tsx index e804bca..4c628d8 100644 --- a/admin-spa/src/components/ui/dropdown-menu.tsx +++ b/admin-spa/src/components/ui/dropdown-menu.tsx @@ -57,20 +57,46 @@ DropdownMenuSubContent.displayName = const DropdownMenuContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef ->(({ className, sideOffset = 4, ...props }, ref) => ( - - - -)) +>(({ className, sideOffset = 4, ...props }, ref) => { + // Get or create portal container inside the app for proper CSS scoping + const getPortalContainer = () => { + const appContainer = document.getElementById('woonoow-admin-app'); + if (!appContainer) return document.body; + + let portalRoot = document.getElementById('woonoow-dropdown-portal'); + if (!portalRoot) { + portalRoot = document.createElement('div'); + portalRoot.id = 'woonoow-dropdown-portal'; + // Copy theme class from documentElement for proper CSS variable inheritance + const themeClass = document.documentElement.classList.contains('dark') ? 'dark' : 'light'; + portalRoot.className = themeClass; + appContainer.appendChild(portalRoot); + } else { + // Update theme class in case it changed + const themeClass = document.documentElement.classList.contains('dark') ? 'dark' : 'light'; + if (!portalRoot.classList.contains(themeClass)) { + portalRoot.classList.remove('light', 'dark'); + portalRoot.classList.add(themeClass); + } + } + return portalRoot; + }; + + return ( + + + + ); +}) DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName const DropdownMenuItem = React.forwardRef<