ng-matero / extensions

Angular Material Extensions Library.
https://ng-matero.github.io/extensions/
MIT License
388 stars 48 forks source link

MtxPopover doesn't refresh position when content size changes #260

Closed adrianbenjuya closed 5 months ago

adrianbenjuya commented 6 months ago

If the content of the MtxPopover changes when it has already been opened, the popover doesn't refresh its position. This causes a problem when the popover size is bigger enough that goes off the screen. It will fix after closing and reopening the popover (probably a recalculation of the position happens).

Is there a way to fix this?

I share a stackblitz with the reproduction: https://stackblitz.com/edit/bhvwhw?file=src%2Fexample%2Fbadge-overview-example.html (probably to make it work you need to play with the top property of the button, as the reproduction depends on the size of your screen)

chrome_86o7RwOFH0

nzbin commented 5 months ago

In fact, the popover has already update its size and the long content is overflow screen. You can set overflow auto for the popover content. https://stackblitz.com/edit/bhvwhw-xzrssg?file=src%2Ftheme.scss

.mtx-popover-content {
  height: 100%;
  overflow: auto;
}
adrianbenjuya commented 5 months ago

Thanks, your solution is working, but just curious, is there any way to relocate the popover once it changes its size? in the case of this example: move it a bit to the top? until its content fits in the screen

nzbin commented 5 months ago

I'm not sure, you can test the CDK overlay by yourself.