Conversation
Use the CDK block scroll strategy so opening mobile navigation keeps the scrollbar and does not cross responsive breakpoints in Safari. Fixes angular#69036
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
PR Type
What is the current behavior?
Opening the mobile navigation sets
overflow-y: hiddenonbody. 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
bodyis 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?
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:testnavigation spec passes. The normal local asset copy initially hit an unrelatedEACCESoncastle-sign.png, so the same target was rerun with static asset copying disabled for the unit-test run.