From 35b7c4fc2d3d0b5a1dad9e0ff97b472502ce592a Mon Sep 17 00:00:00 2001 From: ajnart Date: Tue, 28 Jul 2026 16:38:38 +0200 Subject: [PATCH] fix: layer mobile widget details above header --- packages/modals/src/index.tsx | 5 +++-- packages/ui/src/index.ts | 1 + packages/ui/src/theme.ts | 6 ++++++ packages/ui/src/theme/layers.ts | 5 +++++ packages/ui/src/theme/modal.spec.ts | 16 ++++++++++++++++ packages/ui/src/theme/modal.ts | 5 +++++ 6 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 packages/ui/src/theme/layers.ts create mode 100644 packages/ui/src/theme/modal.spec.ts diff --git a/packages/modals/src/index.tsx b/packages/modals/src/index.tsx index 0071185a8..ef365647c 100644 --- a/packages/modals/src/index.tsx +++ b/packages/modals/src/index.tsx @@ -2,12 +2,13 @@ import type { PropsWithChildren } from "react"; import { createContext, useCallback, useContext, useEffect, useReducer, useRef, useState } from "react"; -import { getDefaultZIndex, Modal } from "@mantine/core"; +import { Modal } from "@mantine/core"; import { randomId } from "@mantine/hooks"; import type { stringOrTranslation } from "@homarr/translation"; import { translateIfNecessary } from "@homarr/translation"; import { useI18n } from "@homarr/translation/client"; +import { managedModalZIndex } from "@homarr/ui"; import type { ConfirmModalProps } from "./confirm-modal"; import { ConfirmModal } from "./confirm-modal"; @@ -99,7 +100,7 @@ const ActiveModal = ({ modal, state, handleCloseModal }: ActiveModalProps) => { 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" } };