valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

[Bug] Popover with adaptive position recalculates opened dropdown position #6588

Open sutkovoy opened 1 year ago

sutkovoy commented 1 year ago

StackBlitz that reproduces the issue: https://stackblitz.com/edit/angular-ngx-bootstrap-5913-traiei?file=src%2Fapp%2Fapp.component.ts

Open stackblitz. Scroll elements inside the container. Click on the dropdown and scroll again. Hover over "Live demo" popover.

Observe the result:

AR: Dropdown position is recalculated. In some case, new menu position is wrong and placed over the dropdown button ER: Popover with adaptive position doesn't impact dropdown position

img

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 6.2.0 (also reproduced on 9.0.0)

Angular: 15

Bootstrap: 3.3.7

sutkovoy commented 1 year ago

Additional info: It seems that both directives use the same instance of PositioningService and after hovering over popover, it pushes the new config into PositioningService options. From:

{
            modifiers: {
                flip: {
                    enabled: false,
                },
                preventOverflow: {
                    enabled: false,
                },
            },
        }

To:

{
            modifiers: {
                flip: {
                    enabled: true,
                },
                preventOverflow: {
                    enabled: true,
                },
            },
        }