ng-bootstrap icon indicating copy to clipboard operation
ng-bootstrap copied to clipboard

Popover positioned partially off-screen and cropped

Open peterblazejewicz opened this issue 6 years ago • 5 comments

The top popover, when triggered near the page border, is being rendered in such way it gets cropped: https://stackblitz.com/angular/rdokjdpkdoq https://ng-bootstrap.github.io/#/components/popover/examples

image

The BS uses popper.js, rendering in 4.1.3:

image

ng-bootstrap: v4.0.0 Chrome, macOS

peterblazejewicz avatar Dec 12 '18 19:12 peterblazejewicz

Ok, will reopen this as a feature request.

In case of the top placement above, bootstrap/popper SHIFT the popover horizontally until it fits (note the arrow is not centered), we will just crop it if ONLY top is specified → we don't support this feature.

P.S. Workaround would be using [position]="['top', 'auto']"

maxokorokov avatar Feb 19 '19 15:02 maxokorokov

Any update on this ?

Sachin4dotnet avatar May 01 '19 09:05 Sachin4dotnet

Pretty sure this is a bug. Secondary positioning should be applied to the arrow and not the whole popover window. At least that's how it works in popper.js

placement="top" results in top-center placement in positionElements. I believe the center placement should apply to the arrow and not the whole window. That way the popover will always be in the viewport as it's only moved above the reference object. And the arrow is centered to the reference element.

pelgro avatar Sep 18 '19 07:09 pelgro

@maxokorokov Any update? This is an incredibly annoying shortcoming of using popovers in this library.

Michael-Ziluck avatar Jan 30 '20 19:01 Michael-Ziluck

Any Update on this bug?

janwidmer avatar Jan 02 '24 12:01 janwidmer