Comments (10)
Considering 90% of bugs reported don't include a reproducible example (these are the most fun to debug 🙃🙃🙃), this will be more than enough. Thanks for taking the time.
from react-tooltip.
Whelp, that's embarassing. Sneaky regression bugs.
Feel free to use [email protected]
That's the only change from v5.21.6, so don't worry about the beta tag. Once we do an official release, we'll close this and you should be able to upgrade without trouble.
Confirming it works with the beta version
from react-tooltip.
Fix available on official release [email protected]
.
from react-tooltip.
It would make sense if the second svg failed to display the tooltip, since the tooltip only checks for potential anchors at the time it is mounted on the DOM, so elements added afterwards are usually ignored. (this is incorrect, see below)
As a workaround, you can force a re-render on the tooltip so that it does the check again. The easiest way in your example is like this:
<Tooltip id="my-tooltip" key={visible} />
but you can try other ways.
This isn't a fix though, so we'll leave this open for now.
from react-tooltip.
Thanks for the reply and great library, love the work you're putting in!
It would make sense if the second svg failed to display the tooltip
My initial thought as well, odd that the first one fails.
Since our svg is scattered across various components, passing around the key is a slight pain, our workaround is:
useEffect(() => {
const elements = document.querySelectorAll("rect");
elements.forEach((element) => {
const id = element.getAttribute("data-tooltip-id")!;
const content = element.getAttribute("data-tooltip-content")!;
element.setAttribute("data-tooltip-content", content);
element.setAttribute("data-tooltip-id", id);
});
}, [visible]);
(which I'm not completely certain on why it works).
from react-tooltip.
@fatton139 I'd have to check, but very likely that works because updating the data-tooltip-content
attribute of an anchor triggers a tooltip re-render, which makes the tooltip check again for all anchors.
Glad to know it works for now for your project, and we'll definitely be investigating this.
from react-tooltip.
If it helps, here is an example outside an SVG:
https://codesandbox.io/s/nostalgic-heisenberg-tkz68f?file=/src/App.tsx
from react-tooltip.
For future reference.
It would make sense if the second svg failed to display the tooltip, since the tooltip only checks for potential anchors at the time it is mounted on the DOM, so elements added afterwards are usually ignored.
This only applies when using anchorSelect
without the data-tooltip-id
attribute. As seen here, elements added to the DOM which have the data-tooltip-id
attribute are automatically detected, without needing to force a tooltip re-render.
from react-tooltip.
Whelp, that's embarassing. Sneaky regression bugs.
Happens to the best of us
Feel free to use
[email protected]
That's the only change from v5.21.6, so don't worry about the beta tag. Once we do an official release, we'll close this and you should be able to upgrade without trouble.
Tested on our end and works brilliantly! Thanks for the quick resolution! 💖
from react-tooltip.
The beta version you mentioned fixed a similar issue for a project I'm working on and we are using the data-tooltip-id
only (without anchorSelect
).
In our case we are adding a new element with tooltip data-attributes after a POST API call, and only the added element would show the tooltip without refresh.
from react-tooltip.
Related Issues (20)
- [BUG] When using default rt-transition-show-delay, tooltip stays in DOM after visibly closing HOT 13
- [BUG] Infinite rerender loop when tooltip is open for an anchor that is inside a scrolled overflow HOT 2
- [BUG] "mousemove" is not working on drag but "pointermove" event will work HOT 9
- [BUG] Strings are not escaped properly HOT 2
- [BUG] when i zoom out or in the big screen resolutions the tooltip is not in right place HOT 3
- Can't import the named export 'arrow' from non EcmaScript module (only default export is available) HOT 7
- [BUG] openEvents does not work with "click" HOT 4
- Is is possible to export default middlewares? HOT 1
- [BUG] Testing react-tooltip with modal result to a failed HOT 1
- [BUG] Tooltip shows briefly when using delayShow and moving to directly adjacent element HOT 3
- [FEAT REQ] Render tooltips inside portal HOT 4
- [BUG] CSP breaks, styles are injected even after disableStyleInjection is used HOT 2
- The component doesn't show the tooltip when there is a single quote " ' " in the data-tooltip-id and the id passed on the Tooltip component. HOT 2
- Safari mobile browser gets the error e.getAttributeNames HOT 2
- [BUG] : When ' (single quote) is used any where in the text, the tooltip doesn't open HOT 4
- I have set opacity to 1 but I can still see though HOT 3
- [BUG] HOT 2
- [BUG] anchor element does not close the tooltip on click HOT 3
- [BUG] #1042 Regression from 5.26.0 → 5.26.1 HOT 1
- Tooltip is not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-tooltip.