Skip to content

fix(scraps): Size the modal portal to the viewport while a modal is open - #132285

Draft
sentry-junior[bot] wants to merge 1 commit into
masterfrom
fix/modal-portal-viewport-size
Draft

sentry-junior[bot] wants to merge 1 commit into
masterfrom
fix/modal-portal-viewport-size

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

#129847 made #modal-portal a query container (container-type: inline-size). The portal has no height of its own, because everything inside it is position: fixed.

Safari and iOS Safari before 18.4 also applied layout containment to container-type, which makes the element the containing block of its fixed descendants. WebKit dropped that in 18.4 (release notes: "Dropped layout containment from container-type", WebKit 277122). On those versions the backdrop and the modal's scroll container are sized to the empty portal:

  • The dialog is in the DOM but has no visible area. It ends up below the fold.
  • Taps go through to the page behind it.
  • Scroll lock still pins the body, so the page looks frozen.

That fits the "Delete doesn't respond while a confirm modal is open" replays and #132108. Our browserslist still includes Safari 17.0–18.3 and iOS 18.0–18.3, and every iOS browser uses WebKit.

While a modal is open, the portal now gets position: fixed; inset: 0 and the modal z-index. The fixed backdrop and overlay then resolve against a viewport-sized box in every engine. The portal's width (the container query width) stays the viewport width, and positioned overlays inside it keep the modal layer. The styles are removed on close, so the empty portal never covers the page.

This is the first of two changes for mobile modals. The second covers useScrollLock nesting, scroll restore when one modal replaces another, and visual-viewport sizing for the on-screen keyboard.

Open before review: confirm on a real Safari or iOS 18.2/18.3 device, for example with the framework suggestion modal story from #132201, or a confirm modal from the issue list.

Refs #132108

via @natemoo-re.

--

View Session [Sentry]

The modal portal is a query container with no height. Safari and iOS before 18.4 made a query container the containing block of its fixed descendants, so the backdrop and dialog were sized to the empty portal. The modal was in the DOM but invisible, taps reached the page behind it, and the body scroll lock left the page frozen.

Refs #132108

Co-Authored-By: nate <7118177+natemoo-re@users.noreply.github.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Story previews

Preview the stories changed in this PR on the Vercel deployment:

Preview deployment: https://sentry-dik812itv.sentry.dev

This branch was successfully deployed

1 active deployment
Preview — 5cb352ac Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant