Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In IE11, when the popper is near the viewport boundary, extra spacing is added to the page creating a scrollbar #636

Closed
caseyjhol opened this issue May 28, 2018 · 7 comments

Comments

@caseyjhol
Copy link

https://codepen.io/caseyjhol/pen/BVBOVL

popper_scroll

Steps to reproduce the problem

  1. Click the ref element

What is the expected behavior?

The green pop element appears above the ref element and the rest of the page remains as is with no scrollbar.

What went wrong?

Extra spacing is created below the ref element, creating a scrollbar.

This appears to work properly in all browsers except IE10 and IE11.

I'm using a click listener for the popper (and showing it using display: block to make the issue easier to see, but it persists without one as well (https://codepen.io/caseyjhol/pen/VdZGRY). This issue is the cause of twbs/bootstrap#24851. I go into more detail here: twbs/bootstrap#24851 (comment).

@FezVrasta
Copy link
Member

This is not a Popper.js problem, you should apply an initial position to your popper element so that it doesn't cause any overflow (usually top 0 and left 0), we can't do that in Popper.js because it would already be too late.

@caseyjhol
Copy link
Author

caseyjhol commented May 29, 2018

The problem is occurring because Popper is applying the style top: 0, left: 0 to the element. Because the reference element's parent is positioned relatively, if Popper could detect the element is near the bottom edge of the viewport (which it's already doing) and set bottom: 0, left: 0 instead, the issue could be avoided. This would only come into effect if the parent element is positioned, and could potentially be accomplished with 1 line of code.

@caseyjhol
Copy link
Author

@FezVrasta I found a way to fix this with a minimal addition of code (just a few lines). Would you be open to a PR?

@FezVrasta
Copy link
Member

Yes I'd be curious to see your proposed solution, but absolutely it's not a bug, maybe a not super clear behavior. Popper elements are supposed to be positioned (initially, by your CSS) in a way that doesn't cause overflows.

@caseyjhol
Copy link
Author

caseyjhol commented May 30, 2018

The problem occurs because of the top: 0, left: 0 styling that is applied by Popper prior to being positioned correctly via the transform property. So, even if the Popper is positioned manually beforehand, it's irrelevant, because Popper changes the positioning (see https://codepen.io/caseyjhol/pen/wXBdxr). I'll work on getting a PR together today.

@craig-jennings
Copy link

I had the same issue, but was able to get around it by disabling gpuAcceleration.

new Popper(..., ..., {
  modifiers: {
    computeStyle: {
      gpuAcceleration: false,
    },
  },
});

@caseyjhol
Copy link
Author

@craigjennings11 Awesome - looks like that works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants