Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/api/tooltips/ToolTip.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Tooltip extends EventEmitter {
}
) {
super();

this.parentElement = parentElement;
const { vNode, destroy } = mount({
components: {
TooltipComponent: TooltipComponent
Expand Down Expand Up @@ -67,6 +67,12 @@ class Tooltip extends EventEmitter {
* @private
**/
show() {
const parentExists = this.parentElement && document.body.contains(this.parentElement);

if (!parentExists) {
console.warn('Tooltip parent does not exist anymore!');
return;
}
document.body.appendChild(this.component.$el);
this.isActive = true;
}
Expand Down
3 changes: 3 additions & 0 deletions src/api/tooltips/components/TooltipComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export default {
inject: ['toolTipText', 'toolTipLocation', 'parentElement', 'cssClasses'],
computed: {
toolTipCoordinates() {
if (!this.parentElement || !document.body.contains(this.parentElement)) {
return { top: 0, left: 0, height: 0, width: 0 };
}
return this.parentElement.getBoundingClientRect();
},
toolTipLocationStyle() {
Expand Down
4 changes: 4 additions & 0 deletions src/api/tooltips/tooltipMixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const tooltipHelpers = {
return;
}
let parentElement = this.$refs[elementRef];
if (!parentElement || !document.body.contains(parentElement)) {
console.warn('Cannot create tooltip: parent element does not exist');
return;
}
if (Array.isArray(parentElement)) {
parentElement = parentElement[0];
}
Comment on lines +56 to 62
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null check should occur after handling the Array case. Currently, if parentElement is an array, document.body.contains() will be called with an array instead of an element, which may not work as expected. Consider moving the null check to after line 62 where parentElement[0] is extracted.

Suggested change
if (!parentElement || !document.body.contains(parentElement)) {
console.warn('Cannot create tooltip: parent element does not exist');
return;
}
if (Array.isArray(parentElement)) {
parentElement = parentElement[0];
}
if (Array.isArray(parentElement)) {
parentElement = parentElement[0];
}
if (!parentElement || !document.body.contains(parentElement)) {
console.warn('Cannot create tooltip: parent element does not exist');
return;
}

Copilot uses AI. Check for mistakes.
Expand Down
Loading