Popper-core: Is it possible to set popper element to position: fixed?

Created on 8 Sep 2017  ·  11Comments  ·  Source: popperjs/popper-core

In the demo page it states:
"We automatically detect when your popper should be absolutely positioned or fixed. Don't worry about that!"

I have not encountered a situation where the position it ever fixed.
What is the use case for this and can it be enforced?

# QUESTION ❔

Most helpful comment

In the past it decided when to use fixed and then to use absolute, but I switched to an "always absolute" approach because it simplified the logic and didn't introduce major performance issues.

All 11 comments

In the past it decided when to use fixed and then to use absolute, but I switched to an "always absolute" approach because it simplified the logic and didn't introduce major performance issues.

@FezVrasta Will it be possible to reinstate this? in angular its critical to have the popper element sit beside its reference in order to allow for scope binding.
in these cases there is no way to avoid the parent overflow.

It would be great to add it as an optional param, id be happy to put in a PR if you can point me in the right direction.

Doesn't Angular provide a way to create portals?

The positioning logic is pretty complex and supporting the fixed positioning would make it even more complex

What do you mean portals?

I guess if its complicated to support fixed positioning I can do some magic behind the scenes to move the popper element to the body.
But the best approach would defiantly be having it set to position fixed as that would maintain the original layout of the user and simply break any overflow setting.

in case its position fixed, wouldn't the positioning be easier? seeing you would not have to take into account any overflows other then the viewport?

Probably there could be an option to tell Popper.js to use position fixed where it manually sets its parent to body. But i don't plan to spend time on it anytime soon

Ill look into making a PR if it seems a reasonable change.

Thanks!

In a special use case I need _all_ popper elements to be fixed positioned on the screen. Any news on this?

Yes, you can use the positionFixed option. It's very new so there may be some bugs.

@FezVrasta there are some fixes in master right now regarding positionFixed that are waiting for a new npm version, any chance on getting them released soon?

The website still states:
"We automatically detect when your popper should be absolutely positioned or fixed. Don't worry about that!"

This is causing confusion. My team and I have to keep linking people to this issue.
Could you remove it from the website?

Please feel free to send a PR to update the text, I'll merge it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Johann-S picture Johann-S  ·  3Comments

c0bra picture c0bra  ·  5Comments

NilsEnevoldsen picture NilsEnevoldsen  ·  5Comments

QJan84 picture QJan84  ·  4Comments

kerf007 picture kerf007  ·  3Comments