hermes-agent/web/src/lib/dashboard-modal-shell.ts
HexLab 1cf2c763ef
fix(dashboard): opaque MoA presets modal (stop page bleed-through) (#67410)
* fix(dashboard): make MoA presets modal opaque and readable

Card defaults to bg-background-base/80 glass, so the Mixture of Agents
dialog let the Models page bleed through — especially on Cyberpunk/mobile.
Portal an opaque dialog shell above the z-2 dashboard column, and ignore
Escape while the nested model picker is open.

* test(web): lock dashboard modal shell to opaque panel classes

Guard the MoA/dialog shell contract so glass Card defaults cannot
quietly return to modal panels, and Escape stays picker-aware.
2026-07-19 19:09:12 -04:00

29 lines
1.1 KiB
TypeScript

/**
* Shared dashboard dialog shell classes.
*
* Page `<Card>` defaults to `bg-background-base/80` (glass). That looks fine
* on the page canvas, but as a modal panel it lets the Models page bleed
* through and kills readability — especially on Cyberpunk / mobile.
*
* Modal panels must use opaque `bg-card`; backdrops use the same z-index
* band as Auxiliary / Confirm dialogs so they sit above page chrome.
*
* Callers must `createPortal(..., document.body)` — `z-[100]` alone cannot
* escape the dashboard column's `relative z-2` stacking context (see
* ModelPickerDialog / ToolsetConfigDrawer).
*/
export const DASHBOARD_MODAL_BACKDROP =
"fixed inset-0 z-[100] flex items-center justify-center bg-background/85 p-4";
export const DASHBOARD_MODAL_PANEL =
"relative w-full border border-border bg-card shadow-2xl";
/**
* Outer modals that host a nested picker (e.g. MoA → ModelPickerDialog)
* must ignore Escape while the picker is open; the picker owns that key.
*/
export function shouldCloseOuterModalOnEscape(
nestedPickerOpen: boolean,
): boolean {
return !nestedPickerOpen;
}