Weird position behaviour in dynamic routes #1090
Screen.Recording.2023-09-12.at.15.20.18.movIn this video, you can see that the tooltips are placed correctly, on I'm using dynamic routes, and when I click in one of those Icons, there's a request made to the server that returns a new DOM (not all DOM, but some components affected by that route). Could this be the problem? The tooltip loses reference to the anchorSelector? |
Replies: 2 comments 19 replies
|
Some changes made to the DOM are already watched by the tooltip, but this might be an edge case. Which version of Assuming this is a private project that you're unable to share, can you give some insight on your DOM structure? A very simplified example of what it could look like is this: <App>
<ReactTooltip />
<StaticComponents />
<DynamicComponents />
</App>One thing you could try is instead of using Worst case scenario, I'll have to ask for a simple demo reproducing this behavior, which unfortunately might be difficult to do depending on the level of complexity of your DOM structure. But for now lets see what we can do. |
|
If I remove the |

The tooltip is definitely losing the references to the anchors when the route changes, so the position defaults to 0,0 on the screen.
One way that has worked in other situations is to force the tooltip to re-render when the route changes, so the tooltip can get the references to the newly rendered components. Assuming you're using
react-router-domor something similar for your routes, try using thekeyprop. This should force a re-render on route change.As for the tooltip overflowing, I believe it's easier to fix the other stuff first, and then get to that.