Skip to content

Commit 52145ed

Browse files
committed
fix(emcn): promote modal overlay + content wrapper to own compositing layers
The backdrop-blur overlay did not reliably paint above page content the browser had GPU-promoted (position: sticky headers and z-indexed absolutes inside a scroll container, e.g. the scheduled-tasks calendar), so those composited layers bled through the overlay despite its higher z-index. Force the overlay and the content wrapper onto their own compositing layers via translateZ(0) so the compositor honors stacking order. Inherent since the calendar shipped (#4979), not a refactor regression.
1 parent 2c38e63 commit 52145ed

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/emcn/src/components/modal/modal.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ const ModalClose = DialogPrimitive.Close
122122
* Modal overlay component with fade transition.
123123
* Outside interactions are handled by the dialog content so nested poppers can
124124
* close without also dismissing the modal.
125+
*
126+
* `[transform:translateZ(0)]` forces the overlay onto its own compositing layer.
127+
* A `backdrop-blur` overlay does not reliably paint above page content the
128+
* browser has already GPU-promoted — `position: sticky` headers and `z-index`ed
129+
* absolutes inside a scroll container (e.g. the scheduled-tasks calendar) can
130+
* sort ABOVE it despite its higher `z-index`, bleeding through. Promoting the
131+
* overlay (and the content wrapper below, so the panel occludes too) makes the
132+
* compositor honor stacking order.
125133
*/
126134
const ModalOverlay = React.forwardRef<
127135
React.ElementRef<typeof DialogPrimitive.Overlay>,
@@ -131,7 +139,7 @@ const ModalOverlay = React.forwardRef<
131139
<DialogPrimitive.Overlay
132140
ref={ref}
133141
className={cn(
134-
'fixed inset-0 z-[var(--z-modal)] bg-black/10 backdrop-blur-[2px]',
142+
'fixed inset-0 z-[var(--z-modal)] bg-black/10 backdrop-blur-[2px] [transform:translateZ(0)]',
135143
ANIMATION_CLASSES,
136144
className
137145
)}
@@ -229,7 +237,7 @@ const ModalContent = React.forwardRef<
229237
<ModalPortal>
230238
<ModalOverlay />
231239
<div
232-
className='pointer-events-none fixed inset-0 z-[var(--z-modal)] flex items-center justify-center'
240+
className='pointer-events-none fixed inset-0 z-[var(--z-modal)] flex items-center justify-center [transform:translateZ(0)]'
233241
style={
234242
size === 'full'
235243
? undefined

0 commit comments

Comments
 (0)