Allow popper to go outside the boundaries of the container
Asked Answered
M

2

14

I am using popper.js on the items in a custom-built dropdown menu (it's not a <select>). The site uses Bootstrap 4.

My poppers look like this, but I want it to overflow outside of the scrolling container:

enter image description here

I want the poppers to appear on the right-hand side of the elements in the scrolling container, but they are forced to stay inside of it. The scrolling container is a <div>.

Why don't these settings allow the poppers to overflow?:

const indivOptionPopOverSettings = {
        placement: 'left',
        container: 'body',
        trigger: 'hover',
        html: true,
        modifiers: {
            preventOverflow: {
                // tried these individually and in various combinations:
                enabled: false,
                boundariesElement: 'window',
                escapeWithReference: true
            }
        }
};
Morale answered 15/8, 2019 at 18:5 Comment(0)
C
3

The "container: 'body'" attribute allows the pop-over box to be put directly under the body tag and not the div tag hence resolving the issue.

Chante answered 10/3, 2022 at 8:43 Comment(0)
M
-3

The problem went away after I closed my browser entirely and restarted the application. I'm not sure what the root problem was.

Morale answered 21/7, 2020 at 14:48 Comment(6)
@josh_withee, how did you solve this?Hibernate
@Josh Withee I wonder the same. I have the same issue and not much infoElectrothermics
I'm with you people! OP @Josh Withee please elaborate on how you were able to fix this.Messaline
I wish I had more info to share but that is all I did and the problem stopped happening.Morale
Has anyone figured this out, because I added the container: 'body' and it does not seem to do anything.Valentinavalentine
Seems like this this did the trick for me and I did not need the container: 'body' either.Valentinavalentine

© 2022 - 2024 — McMap. All rights reserved.