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.

React bootstrap tooltip overlay is not positioned correctly

See original GitHub issue

Description

I have been working with overlays. I had created a simple tooltip using react bootstrap’s Tooltip class. I have created it in such a way that, whenever the mouse hovers over the button, It shows the tooltip and it’s content. But when I take a look at the result, The tooltip is not positioned correctly.

To Reproduce

Steps to reproduce the behavior:

  1. Created a tooltip using the Tooltip class
  2. Went to the browser to see the result
  3. Discovered that the tooltip is positioned incorrectly

Reproducible Example

Sandbox to show the incorrect positioning.

Expected behavior

Expected the tooltip to be positioned next to the button. On the left side of the button

Screenshots

tooltip

Environment (please complete the following information)

  • Operating System: Windows
  • Browser, Version: Chrome 81
  • React-Bootstrap Version: 1.0.1

Additional context

The same issue occurs with other overlays for me such as popovers.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thepuzzlemastercommented, Feb 13, 2021

@Meryldominguez, I just ran into the same problem. In my case, my overlay, was pointing to a React.FC, and I had to change it to be React.forwardRef in order for the overlay to position correctly. But it worked after I made that change.

1reaction
Meryldominguezcommented, Jan 11, 2021

Hi! Im actually having this issue, despite spreading the injected props. I am working on a Navbar that re-renders based on the ‘status’ of the ‘event’ namely ‘published’,‘pending’, or ‘draft’

<kbd>Screen Shot 2021-01-10 at 11 20 54 PM</kbd>

It seems that if one of the tooltips is triggered when the navbar buttons get re-rendered, I get the placement problem, despite having injected the props.

<kbd>Screen Shot 2021-01-11 at 8 42 58 AM</kbd> ^see above with tooltip in far left top corner

Screen Shot 2021-01-11 at 9 17 59 AM Screen Shot 2021-01-11 at 10 03 01 AM

Any help on this @jquense?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-bootstrap OverlayTrigger is not positioned correctly ...
I have main container with list of buttons and every button is wrapped with OverlayTrigger (Tooltip in overlay). As there are many list...
Read more >
How to Position a React-Bootstrap Popover
In this guide, you'll learn how to use a popover component from the React-Bootstrap library and learn to position it on the page....
Read more >
Why Positioning a Tooltip Accurately with React So ...
We position get the position & size by getBoundingClientRect API of above components, and change the position of overlay to close to trigger ......
Read more >
Overlays | React-Bootstrap
The <Tooltip> and <Popover> components do not position themselves. Instead the <Overlay> (or <OverlayTrigger> ) components, inject ref and style props.
Read more >
Popovers
The Popover component, like the Tooltip can be used with an OverlayTrigger Component, and positioned around it. Holy guacamole! Holy guacamole!
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