Popper-core: scrollParent should be calculated from reference, not popper

Created on 12 Oct 2017  路  7Comments  路  Source: popperjs/popper-core

CodePen demo

Popper should hide when ref is out of scrollable div bounds, instead it gets hidden when ref gets scrolled outside body:
https://codepen.io/anon/pen/dVjRba

Steps to reproduce the problem

  1. Put popper outside of reference's scrollParent
  2. Use scrollParent as boundariesElement

What is the expected behavior?

Popper should try to keep inside reference's scrollParent

What went wrong?

Popper's scrollParent is used as boundariesElement

# BUG 馃悶 low medium modifier

Most helpful comment

OK, I find out we can use boundariesElement: 'viewport' to prevent this issue.

All 7 comments

I believe to be experiencing the same difficulty. Here is another demo. https://codepen.io/brentertz/pen/vejPeK

Thanks, this looks like an easy one. If anyone wants to adopt it feel free to. I'll be happy to help if needed.

I feel like this should have been a breaking change to be honest, not a patch. We were relying on the behavior for our app since we position popovers outside of scroll parents so they don't get hidden by overflow.

May you please provide an example to better understand how did you use it please?

We have a dropdown which may contain subdropdowns in our component library:

screen shot 2017-11-15 at 10 25 48 am

The first dropdown is a scroll container, in case the dropdown is too large in general (wouldn't ever want it being larger than the height of the viewport, for instance) so we would move the subdropdown element to the top level and attach the popper. Updating Popper caused this regression:

screen shot 2017-11-15 at 10 26 13 am

We were able to catch it early and update the popper modifiers to use window as the boundaries element, but it seems like this was a pretty big shift in existing behavior is all. I understand that this is likely the expected behavior to be fair, but given it's the default it could have caused breakage for a lot of people.

It really breaks after upgrading: https://github.com/Akryum/v-tooltip/issues/95
@FezVrasta Any idea?
@pzuraq Did you find any workaround?

OK, I find out we can use boundariesElement: 'viewport' to prevent this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nainardev picture nainardev  路  3Comments

memboc picture memboc  路  3Comments

NilsEnevoldsen picture NilsEnevoldsen  路  5Comments

FezVrasta picture FezVrasta  路  3Comments

tyrw picture tyrw  路  4Comments