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.

Bootstrap tooltip with wrong position inside a .table-responsive

See original GitHub issue

Operating system: Ubuntu 20.04.2 LTS Browser: Firefox 87.0 Reduced test case: https://jsfiddle.net/3r9z1o84/

I’m having a problem while using Bootstrap tooltips inside a parent with overflow: auto, more specifically inside a .table-responsive div. Both buttons are inside a <td> and have data-bs-placement="top", so the tooltip should be placed in the top of them, not anywhere else.

This is what is happening: image image

This is the expected behavior (when overflow-x is removed): image image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
rohit2sharma95commented, Apr 14, 2021

Okay, this is not an issue. Instead a feature of Popper. 🙂 By default, the boundary for the flip modifier is clippingParents, so Tooltip gets flipped. If you want to prevent this behavior you need to change the boundary in the flip modifier using the popperConfig.

{
  name: 'flip',
  options: {
    altBoundary: true,
    boundary: document.body,
    fallbackPlacements: ['top', 'right', 'bottom', 'left']
  }
}

PS: You can not use the boundary option provided by bootstrap since it is used for the preventOverflow modifier only.

1reaction
jasonlewiscommented, Apr 19, 2021

@pbuttelli I had success with the following popperConfig.

popperConfig: function (config) {
  const flip = config.modifiers.find(({ name }) => name === 'flip')

  flip.options = {
    ...flip.options,
    boundary: 'window'
  }

  return config
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap tooltip in wrong position on initial hover, then in ...
I think the problem is occurring because the div that the tooltip is attached to is absolutely positioned. Here is the div tag...
Read more >
Tooltips - Bootstrap
Tooltip position attempts to automatically change when a parent container has overflow: auto or overflow: scroll like our .table-responsive , but still ...
Read more >
Bootstrap tooltip not working correctly with DataTables
You're right, it is Bootstrap's tooltip placement messing with the table. For anybody who's interested in a solution that worked for me, check ......
Read more >
How to Position Tooltip in button using Bootstrap
In Bootstrap 4, you can position the tooltip in various directions (left, right, top, bottom). The positioning of the tooltip is set by ......
Read more >
How to get a Table to display in a Popover?
Popovers. Documentation and examples for adding Bootstrap popovers, like those found in iOS, to any element on your site.
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