Skip to content

Commit e055d05

Browse files
crisbetommalerba
authored andcommitted
fix(connected-position-strategy): wrong logic when determining whether element is on screen (#2677)
Fixes some faulty logic, introduced in #2102, that meant that the overlay considers the viewport's scroll offset when determining how much it overflows on either side. Fixes #2658.
1 parent 29f939a commit e055d05

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib/core/overlay/position/connected-position-strategy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,10 @@ export class ConnectedPositionStrategy implements PositionStrategy {
255255
let y = originPoint.y + overlayStartY + this._offsetY;
256256

257257
// How much the overlay would overflow at this position, on each side.
258-
let leftOverflow = viewportRect.left - x;
259-
let rightOverflow = (x + overlayRect.width) - viewportRect.right;
260-
let topOverflow = viewportRect.top - y;
261-
let bottomOverflow = (y + overlayRect.height) - viewportRect.bottom;
258+
let leftOverflow = 0 - x;
259+
let rightOverflow = (x + overlayRect.width) - viewportRect.width;
260+
let topOverflow = 0 - y;
261+
let bottomOverflow = (y + overlayRect.height) - viewportRect.height;
262262

263263
// Visible parts of the element on each axis.
264264
let visibleWidth = this._subtractOverflows(overlayRect.width, leftOverflow, rightOverflow);

0 commit comments

Comments
 (0)