Skip to content

Commit

Permalink
fix(core/tooltip): null before register event listener to trigger (#1251
Browse files Browse the repository at this point in the history
)

Co-authored-by: Lukas Maurer <[email protected]>
  • Loading branch information
danielleroux and nuke-ellington authored May 8, 2024
1 parent 57fa028 commit 346fb9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/popular-crabs-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@siemens/ix": patch
---

fix(core/tooltip): null check before event listener gets registered on trigger
6 changes: 5 additions & 1 deletion packages/core/src/components/tooltip/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class Tooltip implements IxOverlayComponent {
}
}

private async queryAnchorElements(): Promise<Array<HTMLElement>> {
private async queryAnchorElements(): Promise<Array<HTMLElement> | undefined> {
if (typeof this.for === 'string') {
return Promise.resolve(Array.from(document.querySelectorAll(this.for)));
}
Expand All @@ -253,6 +253,10 @@ export class Tooltip implements IxOverlayComponent {
this.disposeListener();
}

if (!triggerElementList) {
return;
}

triggerElementList.forEach((element) => {
const onMouseEnter = () => {
this.showTooltip(element);
Expand Down

0 comments on commit 346fb9a

Please sign in to comment.