demo · v144

Backdrop Shield

A canonical UI bug: open a modal, scroll on the backdrop—the page underneath also scrolls, breaking the trap. The backdrop is an overflow: auto element with no overflowing children, so pre-144 overscroll-behavior: contain didn’t apply. v144 makes it apply unconditionally.

overscroll-behavior: checking…

scroll the page down a bit, then open the modal and try to scroll on the dimmed backdrop (the area around the modal). pre-144 chained to the page; v144 stays contained.

Lorem ipsum content below to make the page actually scrollable so you can see the effect.

page scroll: 0px

page filler — scroll the document to confirm whether backdrop scrolling chains here

half-way

bottom marker

the API

.backdrop {
  position: fixed;
  inset: 0;
  overflow: auto;                  /* no overflowing content */
  overscroll-behavior: contain;    /* v144 honours this even with no overflow */
}

see also