Skip to content

Fix(cdk/overlay): vertical positioning of flexible connected overlay on mobile - #28425

Open
ShukinDmitriy wants to merge 1 commit into
angular:mainfrom
ShukinDmitriy:main
Open

Fix(cdk/overlay): vertical positioning of flexible connected overlay on mobile#28425
ShukinDmitriy wants to merge 1 commit into
angular:mainfrom
ShukinDmitriy:main

Conversation

@ShukinDmitriy

@ShukinDmitriy ShukinDmitriy commented Jan 15, 2024

Copy link
Copy Markdown

Fixes #13614.

Summary

Flexible connected overlays using overlayY: 'bottom' calculated their position
relative to documentElement.clientHeight, even when their actual containing
block was the overlay container with different dimensions.

This change calculates the bottom offset relative to the overlay container for
regular overlays. Native popovers continue to use the viewport because they are
rendered in the top layer and have a different containing block.

The fix does not measure scrollbars or create temporary DOM elements in the
reposition path.

Testing

Added regression coverage for:

  • an upward-flowing overlay on a long, horizontally and vertically scrollable page;
  • positioning before and after scrolling and calling updatePosition();
  • a shifted and resized overlay container;
  • native popovers whose containing block remains the viewport.

The CDK overlay unit suite passes in Chromium and Firefox.

@google-cla

google-cla Bot commented Jan 15, 2024

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@josephperrott
josephperrott requested a review from a team as a code owner December 18, 2024 17:40
@mmalerba
mmalerba removed the request for review from a team February 20, 2025 02:24
@ShukinDmitriy

Copy link
Copy Markdown
Author

Hi! I’ve rebased and refreshed this PR against the current main.

The previous scrollbar-based implementation has been replaced with a
containing-block-aware calculation, and regression tests have been added for
the scrolled overlay-container path and the newer native popover path.

The CDK overlay unit suite passes in both Chromium and Firefox. This is ready
for review again. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertical positioning of flexible connected overlay on mobile

1 participant