Description
When using Window or Window.Group, the z-index counter increments unboundedly on every bringToFront call. In long-running applications or with frequent window interactions, the z-index eventually exceeds modal and menu z-indexes, breaking the expected stacking order.
Root Cause
WindowGroup.tsx (lines 123-127): bringToFront increments zIndexCounterRef without any cap
use-window-state.ts (lines 313-321): same issue for non-group windows with global portalZIndex/containerZIndex counters
- Starting values:
200 for portal, 1 for container — no maximum defined
Expected Behavior
Z-index should stay within reasonable bounds and not exceed system-level z-indexes (modals, menus, tooltips). Options:
- Cap the z-index at a configurable maximum
- Normalize/compact z-indexes periodically (reassign 1..N based on current stacking order)
- Provide a
maxZIndex or zIndexStrategy prop on Window.Group
Reproduction
- Create a
Window.Group with multiple windows
- Click on windows repeatedly to bring them to front
- Open a Mantine Modal — the windows will eventually render above the modal
Reported by
Discord user 0x7d8 (05/04/2026)
Description
When using
WindoworWindow.Group, the z-index counter increments unboundedly on everybringToFrontcall. In long-running applications or with frequent window interactions, the z-index eventually exceeds modal and menu z-indexes, breaking the expected stacking order.Root Cause
WindowGroup.tsx(lines 123-127):bringToFrontincrementszIndexCounterRefwithout any capuse-window-state.ts(lines 313-321): same issue for non-group windows with globalportalZIndex/containerZIndexcounters200for portal,1for container — no maximum definedExpected Behavior
Z-index should stay within reasonable bounds and not exceed system-level z-indexes (modals, menus, tooltips). Options:
maxZIndexorzIndexStrategyprop onWindow.GroupReproduction
Window.Groupwith multiple windowsReported by
Discord user
0x7d8(05/04/2026)