angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.38k stars 6.75k forks source link

Setting `withPush(true)` does not work as expected on cdk overlay #17585

Open alexbjorlig opened 5 years ago

alexbjorlig commented 5 years ago

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/fork/components-issue

Steps to reproduce:

  1. Open this stackblitz.
  2. Follow the steps in this gif (resize window to less than 222px, and open overlay):

overlay height bug

Expected Behavior

When viewport height is too low, I expect the overlay to be centered in the viewport. To quote the overlay api withPush:

Sets whether the overlay can be pushed on-screen if none of the provided positions fit.

Actual Behavior

The overlay is positioned with the provided position strategies:

.withPositions([
        {
          panelClass: 'custom-panel1',
          originX: 'center',
          originY: 'center',
          overlayX: 'start',
          overlayY: 'top',
        },
        {
          panelClass: 'custom-panel2',
          originX: 'center',
          originY: 'center',
          overlayX: 'start',
          overlayY: 'bottom',
        },
      ]),

But none of them should be used, because they push the content off-screen.

Environment

PatoDeVille commented 1 year ago

any updates on this?