question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When the popper doesn't fit in the viewport...

See original GitHub issue

It 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:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jrmyiocommented, Nov 16, 2017

@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 as data-x-out-of-boundaries is not added when the target is visible and the popper doesn’t fit.

0reactions
FezVrastacommented, Dec 19, 2019

Yes that’s not a thing anymore on v2

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found