A share dialog is supposed to dim the whole page. You give the dimmed backdrop position: fixed and inset: 0. That combination usually covers the window. Instead, the dimming sits only on one card. The rest of the page stays bright and clickable.

The overlay is not broken. It is obeying a different containing block. A parent, often one with a small transform used to lift the card, has become the reference for fixed.

The layout

A card lifts a little on hover. The share overlay is rendered inside the card, because that is where the button lives.

<section class="card"> <h2>Quarterly report</h2> <button type="button">Share</button> <div class="overlay"> <div class="dialog">Share this file</div> </div> </section> 
.card:hover, .card.is-open { transform: translateY(-8px); } .overlay { position: fixed; inset: 0; background: rgb(0 0 0 / 0.4); } 

When the card is open, or hovered, the overlay covers only the card.

What we measured

We tested this in Chrome 156 on November 13, 2026. A 240 by 160 pixel card sat on an 800-pixel-wide page. The overlay used position: fixed; inset: 0.

  • With no transform on the card, or with transform: none, the overlay sat at the top left of the viewport and covered the window.
  • With transform: translateY(-8px), the overlay sat on the card. Its box matched the card's inner size, 236 by 156 pixels, which is the card minus its 2-pixel border.
  • The same card-sized result appeared with transform: translate(0, 0). A move of zero was enough.

That last case is the one that is easy to miss. A "do nothing" transform still counts.

Why fixed leaves the viewport

position: fixed is described, in everyday use, as "relative to the viewport." MDN's page on position gives the fuller rule. The containing block is the viewport, unless an ancestor has transform, perspective, or filter set to a value other than none. That ancestor then becomes the containing block. MDN also says that will-change: transform establishes a new containing block.

CSS Position Level 3 lists properties that can make a box a fixed-position containing block. It names transform, will-change, and contain.

Our Chrome tests matched those documents:

  • filter: brightness(1) (a visual no-op) pinned the overlay to the card.
  • will-change: transform did the same.
  • contain: paint did the same.
  • perspective: 500px did the same.
  • will-change: opacity did not. The overlay covered the viewport, as it did with no transform. That fits MDN, which names will-change: transform, not every will-change value.

The fix: move the overlay, or move the transform

The overlay has to live outside the element that creates the containing block.

The most direct approach is to render the overlay as a child of document.body, not inside the card. A UI library's "portal" does this. After the move, position: fixed; inset: 0 refers to the viewport again. That holds as long as no other ancestor on the way up has transform, filter, perspective, will-change: transform, or contain: paint.

If the lift effect is the only reason for the transform, apply it to an inner element, and keep the overlay outside that inner element:

<section class="card"> <div class="card-face"> <h2>Quarterly report</h2> <button type="button">Share</button> </div> </section> 
.card:hover .card-face, .card.is-open .card-face { transform: translateY(-8px); } 

The card wrapper itself has no transform. An overlay that is a sibling of .card-face, or a child of body, is not trapped by the lift.

Do not rely on "resetting" the parent with transform: none if some other code then sets translate(0, 0). As our test showed, a zero translate still creates the containing block.

A short checklist

  • position: fixed; inset: 0 covers the window only when the containing block is the viewport.
  • Inspect ancestors for transform, filter, or perspective values other than none, for will-change: transform, and for contain: paint.
  • A zero translate, or a filter that does not change the look, is enough.
  • Move the overlay out of that ancestor, or move the transform onto an inner wrapper that does not wrap the overlay.

On MDN, position is marked Baseline widely available from July 2015, and transform from September 2015.

Sources

PIXEL RECRUITING LLC introduces frontend and UI engineers to product teams that care about details like this one. We mean a modal that really covers the page, not only the card that opened it. We are a direct staffing partner for Mastercard in O'Fallon, MO. Learn more at pixelrecruiting.com.