Skip to content

Commit 9504e84

Browse files
committed
fix: Add instanceof
1 parent c0748b4 commit 9504e84

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/uikit/src/hooks/useTooltip/useTooltip.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ const useTooltip = (content: React.ReactNode, options?: TooltipOptions): Tooltip
125125

126126
const toggleTooltip = useCallback(
127127
(e: Event) => {
128-
const target = e.currentTarget as HTMLElement | null;
129-
const isClickableChild = target?.querySelector("a, button, [role='button']") !== null;
128+
let isClickableChild = false;
129+
if (e.currentTarget instanceof HTMLElement) {
130+
isClickableChild = e.currentTarget.querySelector("a, button, [role='button']") !== null;
131+
}
130132

131133
if (isClickableChild) {
132134
if (!visible) {

0 commit comments

Comments
 (0)