Dynamic tooltip content not working #1160
-
I have an So I have <Tooltip anchorSelect='[data-tooltip-content]' className={styles.tooltip} noArrow place='bottom-start' /> Tooltips work fine on all other components where the content attribute is given content to start, but it doesn't work when the content is dynamic. Am I doing anything wrong or is this a limitation? It looks like it works if I use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The issue is that you're using This is not a bug, since the alternative would be to watch for changes on all elements on the page (instead of just detected anchors), which is something we intentionally avoid. I recommend you use |
Beta Was this translation helpful? Give feedback.
The issue is that you're using
"[data-tooltip-content]"
as the selector. If there is no error (more specifically, ifdata-tooltip-content={undefined}
), the tooltip won't detect it as a valid anchor, so any changes made to it won't be detected.This is not a bug, since the alternative would be to watch for changes on all elements on the page (instead of just detected anchors), which is something we intentionally avoid.
I recommend you use
data-tooltip-id
explicitly, since you might run into other issues selecting the anchors like this.