Skip to content

Commit d8073d8

Browse files
committed
v13.6.3
Fixed re-positioning issue with tooltips.
1 parent ee84dfd commit d8073d8

File tree

7 files changed

+36
-17
lines changed

7 files changed

+36
-17
lines changed

build/cjs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/esm/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "13.6.2",
3+
"version": "13.6.3",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/13.6.2/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GleapTooltipManager.js

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { arrow, autoPlacement, autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom';
1+
import { arrow, autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom';
22
import { GleapSession } from './Gleap';
33
import { loadIcon } from './UI';
44

@@ -33,6 +33,32 @@ export default class GleapTooltipManager {
3333
return this.instance;
3434
}
3535

36+
// Recursive function to process each node and its children
37+
processNodeInsertion(node) {
38+
if (node.nodeType === Node.ELEMENT_NODE) {
39+
// Check the node itself
40+
this.checkNodeTooltip(node);
41+
42+
// Check all children of the node recursively
43+
if (node.childNodes) {
44+
node.childNodes.forEach(childNode => {
45+
this.processNodeInsertion(childNode);
46+
});
47+
}
48+
}
49+
}
50+
51+
// Function to check a single node against the filtered tooltips
52+
checkNodeTooltip(node) {
53+
if (this.filteredTooltips.length > 0) {
54+
this.filteredTooltips.forEach(tooltip => {
55+
if (tooltip.selector && node.matches(tooltip.selector)) {
56+
this.linkTooltip(node, tooltip);
57+
}
58+
});
59+
}
60+
}
61+
3662
start() {
3763
const self = this;
3864

@@ -51,17 +77,10 @@ export default class GleapTooltipManager {
5177

5278
this.observer = new MutationObserver((mutations) => {
5379
mutations.forEach((mutation) => {
80+
// Check for added nodes
5481
mutation.addedNodes.forEach((node) => {
5582
if (node.nodeType === Node.ELEMENT_NODE) {
56-
if (self.filteredTooltips.length > 0) {
57-
self.filteredTooltips.forEach(tooltip => {
58-
if (tooltip.selector) {
59-
if (node.matches(tooltip.selector)) {
60-
self.linkTooltip(node, tooltip);
61-
}
62-
}
63-
});
64-
}
83+
self.processNodeInsertion(node);
6584
}
6685
});
6786

@@ -178,7 +197,7 @@ export default class GleapTooltipManager {
178197
setTimeout(() => {
179198
tooltip.style.visibility = 'hidden';
180199
tooltip.style.pointerEvents = 'none';
181-
}, 400);
200+
}, 200);
182201
}, 500);
183202
}
184203

src/UI.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export const injectStyledCSS = (
193193
box-shadow: 0px 5px 30px rgba(0, 0, 0, 0.2);
194194
opacity: 0;
195195
visibility: hidden;
196-
transition: opacity 0.4s, visibility 0.4s;
196+
transition: opacity 0.2s, visibility 0.2s;
197197
z-index: ${zIndexBase + 100};
198198
}
199199

0 commit comments

Comments
 (0)