diff --git a/apps/nextjs/src/components/layout/header.tsx b/apps/nextjs/src/components/layout/header.tsx index 7007f3ea8..50bb26b3a 100644 --- a/apps/nextjs/src/components/layout/header.tsx +++ b/apps/nextjs/src/components/layout/header.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from "react"; import { AppShellHeader, Group, UnstyledButton } from "@mantine/core"; import { Spotlight } from "@homarr/spotlight"; -import { Link } from "@homarr/ui"; +import { appShellHeaderZIndex, Link } from "@homarr/ui"; import { ClientBurger } from "./header/burger"; import { DesktopSearchInput, MobileSearchButton } from "./header/search"; @@ -31,7 +31,7 @@ export const MainHeader = ({ return ( { return ( { + test("keeps dialogs above the fixed header and managed dialogs above regular dialogs", () => { + expect(appShellHeaderZIndex).toBe(getDefaultZIndex("modal") + 1); + expect(modalZIndex).toBe(appShellHeaderZIndex + 1); + expect(managedModalZIndex).toBe(modalZIndex + 1); + expect(modalComponent.defaultProps).toMatchObject({ zIndex: modalZIndex }); + expect(theme.components?.Drawer?.defaultProps).toMatchObject({ zIndex: modalZIndex }); + }); +}); diff --git a/packages/ui/src/theme/modal.ts b/packages/ui/src/theme/modal.ts index 7bb9f4e69..2ee5918a0 100644 --- a/packages/ui/src/theme/modal.ts +++ b/packages/ui/src/theme/modal.ts @@ -1,5 +1,7 @@ import type { MantineTheme, MantineThemeComponent, ModalProps } from "@mantine/core"; +import { modalZIndex } from "./layers"; + export const modalSizeSelect = "xxl"; export const modalSizeForm = "lg"; @@ -8,6 +10,9 @@ const fixedModalSizes = new Set([modalSizeSelect, modalSizeForm]); const modalWidth = "min(var(--modal-size), calc(100vw - 2 * var(--mantine-spacing-md)))"; export const modalComponent: MantineThemeComponent = { + defaultProps: { + zIndex: modalZIndex, + }, vars: (_theme: MantineTheme, props: Partial) => { if (props.size === modalSizeSelect) { return { root: { "--modal-size": "75rem" } };