Skip to content

ui-kit: modal overlays let overscroll chain to the page underneath #2581

Open

Description

@schlessera

Context

Part of #2576.

The page lock under a modal overlay is a root overflow rule: html:has(dialog.bk-overlay[open]:modal) { overflow: hidden; } (packages/ui-kit/src/tokens.css:2357-2358). The dialog itself has no overscroll-behavior (.bk-overlay, tokens.css:2359-2372). Only .bk-overlay-body contains overscroll (tokens.css:2399-2405). A swipe on a scrim, header or short sheet whose body does not overflow can therefore chain to the root. On Android that is where pull-to-refresh starts.

Guide ui-behaviors/prevent-page-scroll-under-modal-dialog: "MANDATORY: Set overscroll-behavior: contain on the <dialog> element itself … and the dialog::backdrop" and "Set overflow: hidden … on dialog::backdrop so that it becomes a scroll container". The guide also says to drop root locks. Containment on non-scrollable containers ships only from Chromium 144 and cannot be feature-detected, and Samsung Internet 30 is Chromium 143, so the root lock stays until Samsung Internet reaches 144.

Scope

  • Add overscroll-behavior: contain to dialog.bk-overlay:modal.
  • Add overflow: hidden; overscroll-behavior: contain to .bk-overlay::backdrop.
  • Keep the html:has(…) lock. Next to it, add a comment that names the condition for removing it (Samsung Internet on Chromium ≥144), and cite the guide.

Out of scope

  • Removing the root lock.
  • Non-modal destination panels (no backdrop).
  • Sheet swipe dismissal (D54 addendum), which must keep working.
  • Any visual change.

Acceptance criteria

  • Computed styles in Chromium show overscroll-behavior: contain on an open modal .bk-overlay and on its ::backdrop, and overflow: hidden on the backdrop.
  • A real Chromium test (the pinned browser is ≥144) puts a scrollable page under an open short sheet whose body does not overflow, and overrides the root lock inside the test so it cannot mask the result. A wheel or touch scroll over the sheet header and over the scrim leaves the page's scroll position unchanged. With the new declarations removed, the same test fails. Record that mutation in the PR.
  • Sheet swipe dismissal and .bk-overlay-body scrolling behave as before, and overlay visual baselines are unchanged.
  • Changeset for @schlessera/brain-ui-kit (patch).

Verification

node scripts/visual.mjs --project=visual --filter=overlay
node scripts/visual.mjs --project=rail-coarse --filter=overlay-stacking
bun run test packages/ui-kit
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

Only CSS in tokens.css changes.

Activity

  1. added
    type: chore
    area: ui-kit
    priority: p3
    agent-ready
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-kitpriority: p3type: chore

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions