Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cdk/overlay): flexible overlay screen overflow #29904

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
right: '',
position: '',
transform: '',
maxHeight: '',
} as CSSStyleDeclaration);
}

Expand Down Expand Up @@ -1004,13 +1005,17 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {

// We want to set either `top` or `bottom` based on whether the overlay wants to appear
// above or below the origin and the direction in which the element will expand.
const documentHeight = this._document.documentElement!.clientHeight;
if (position.overlayY === 'bottom') {
// When using `bottom`, we adjust the y position such that it is the distance
// from the bottom of the viewport rather than the top.
const documentHeight = this._document.documentElement!.clientHeight;
styles.bottom = `${documentHeight - (overlayPoint.y + this._overlayRect.height)}px`;
styles.maxHeight = `${overlayPoint.y + this._overlayRect.height + scrollPosition.top}px`;
} else {
const remainingScroll =
this._document.documentElement!.scrollHeight - documentHeight - scrollPosition.top;
styles.top = coerceCssPixelValue(overlayPoint.y);
styles.maxHeight = `${documentHeight - overlayPoint.y + remainingScroll}px`;
}

return styles;
Expand Down
Loading