Skip to content

FlexibleConnectonPositionStrategy _pushOverlayOnScreen doesn't take position: fixed into account when the page is scrolled #11763

Closed
@jpzwarte

Description

@jpzwarte

Bug, feature request, or proposal:

So i have a custom component (a popover) that uses CdkOverlay to display a popover anchored to an origin element. The origin element is part of a position: fixed page-header. What happens is that the overlay initially doesn't fit in the narrowed viewport (doesn't fit on the x-axis). It then tries to push the overlay on screen using _pushOverlayOnScreen. While that fixes the x-axis issue, it also breaks the y-axis position.

Since the page is scrolled, it calculates the overflowTop value using the scroll position and then incorrectly adds that value to the y position. This can cause the popover to appear halfway down the page when the page is scrolled significantly.

What is the expected behavior?

It should detect that the origin (parent) element is position: fixed and not take the scroll position into account?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 6.0.3
Cdk 6.2.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions