When the popper doesn't fit in the viewport...
See original GitHub issueIt seems that when the popper doesn’t fit in the viewport the popper can get on top of the target.
I got a usecase with a tooltip where I simply don’t want to show the popper at all if it doesn’t fit the viewport. I couldn’t find any modifier that handles this usecase. Something that looks like data-x-out-of-boundaries
added by the hide modifier (maybe data-x-overlaps
) could really help.
As a solution I used the follow snippet:
flip: {
// We are using null to hide the popper if it doesn't fit anywhere
behavior: ['bottom', 'top', 'right', 'left', null],
},
The null makes it so that data-placement
becomes "null"
and I use visible: hidden
to prevent to popper from showing.
I was wondering if I am missing something and if the use of “null” was even meant to be a thing.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
When the popper doesn't fit in the viewport... #493 - GitHub
It seems that when the popper doesn't fit in the viewport the popper can get on top of the target. I got a...
Read more >How to make popper show the scrollbars when it doesn't fit the ...
I would like to have the pop-up show the scrollbars instead. View it on JSFiddle.
Read more >FAQ - Popper
My popper is bigger than the viewport, what do I do? · Prevent the popper's width from ever exceeding the browser's width with...
Read more >Everything I Know About Positioning Poppers (Tooltips ...
Problem 4: offsetParent If the popper is not positioned relative to the viewport, we need to consider its offsetParent when measuring the ...
Read more >@popperjs/core - npm
No flipping: CSS poppers will not flip to a different placement to fit better in view if necessary. While you can manually adjust...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@FezVrasta I am ware of hide modifier and its
data-x-out-of-boundaries
. This seems to be added when target is not in the viewport. I don’t think this is related to my question asdata-x-out-of-boundaries
is not added when the target is visible and the popper doesn’t fit.Yes that’s not a thing anymore on v2