Skip to content

fix(docs-infra): preserve viewport width when locking scroll - #70780

Open
splincode wants to merge 1 commit into
angular:mainfrom
splincode:splincode/fix-safari-scroll-gutter
Open

splincode wants to merge 1 commit into
angular:mainfrom
splincode:splincode/fix-safari-scroll-gutter

Conversation

@splincode

Copy link
Copy Markdown
Contributor

PR Checklist

  • The commit message follows our guidelines
  • Tests for the changes have been added
  • Docs have been added / updated

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Opening the mobile navigation sets overflow-y: hidden on body. In desktop Safari with a classic scrollbar, this changes the content width by the scrollbar width and can cross the 700px responsive breakpoint while the menu is opening.

The existing stable gutters added in #69154 and #69332 do not prevent the width change when body is used to lock scrolling.

Issue Number: #69036

What is the new behavior?

The navigation uses the CDK block scroll strategy. It keeps the scrollbar present while locking the page, preserves the content width and active media query, and restores the previous scroll position when the menu closes.

The CDK overlay structural styles are now included globally so the scroll-blocking class is effective. Tests cover enabling, disabling, and cleanup when the navigation component is destroyed.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Verified in Playwright WebKit 26.6 at viewport widths 390, 696, 703, 710, and 1024px. The document and body widths, responsive breakpoint result, and content position remain unchanged while scrolling is blocked; the previous scroll position is restored after closing.

The targeted //adev:test navigation spec passes. The normal local asset copy initially hit an unrelated EACCES on castle-sign.png, so the same target was rerun with static asset copying disabled for the unit-test run.

Use the CDK block scroll strategy so opening mobile navigation keeps the scrollbar and does not cross responsive breakpoints in Safari.

Fixes angular#69036
@pullapprove
pullapprove Bot requested a review from kirjs September 17, 2026 10:12
@angular-robot angular-robot Bot added the area: docs-infra Angular.dev application and infrastructure label Sep 17, 2026
@ngbot ngbot Bot added this to the Backlog milestone Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs-infra Angular.dev application and infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant