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

bug(cdk/overlay): Overlay out of viewport bounds #25059

Open
1 task
StefanRetief opened this issue Jun 10, 2022 · 2 comments
Open
1 task

bug(cdk/overlay): Overlay out of viewport bounds #25059

StefanRetief opened this issue Jun 10, 2022 · 2 comments
Labels
area: cdk/overlay P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@StefanRetief
Copy link

StefanRetief commented Jun 10, 2022

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using a position strategy connected a wide element and attempting to position an overlay using a position of a different element, the overlay will not be positioned correctly.

For example, I have a button in a container. The container spans the full width of the view and the button it positioned to the top right of the container. I would like to position the overlay so that it is under the button but connected to the container. When I click the button, I expect the overlay to be positioned correctly within the view.

From my initial investigation, the issue seems to be related to the max-width and max-height CSS attributes provided by the .cdk-overlay-pane

max-width: 100%;
max-height: 100%;

In my stackblitz sample, I copied over these attributes into the styles.css file (line 56-57). If those lines are commented out/removed, the overlay will work as intended. It appears that when attempting to calculate whether or not the overlay will be within the view, the min-width and min-height will affect the calculation. Also good to note that if the overlay is connected to the button instead of the container, the overlay will also work as inteded. However, for my specific use case, that is not possible due to other technical limitations.

Reproduction

https://stackblitz.com/edit/angular-ivy-knuuwz?file=src/app/app.component.ts

Expected Behavior

The expected behavior is that, regardless of which element the overlay is connected it, it will be positioned correctly within the view.

Actual Behavior

When attempting to position the overlay, the overlay will be pushed outside of the view

Environment

  • Angular: 12.2.11
  • CDK/Material: 12.2.11
  • Browser(s): Chrome/Edge
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@StefanRetief StefanRetief added the needs triage This issue needs to be triaged by the team label Jun 10, 2022
@zarend zarend added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: cdk/overlay and removed needs triage This issue needs to be triaged by the team labels Jun 22, 2022
@muneebkq
Copy link

any update ?

@ghost
Copy link

ghost commented Jan 4, 2023

I came in here to report a similar issue with CDK 15.0.3 not providing the styling for "cdk-overlay-container" and related css classes.
When I see how many bugs you have open... I am like "what a mess" - definitly not the right component lib to work with.

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/overlay P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

3 participants