aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/molecules/modals/tooltip/tooltip.tsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/components/molecules/modals/tooltip/tooltip.tsx b/src/components/molecules/modals/tooltip/tooltip.tsx
index b3a3f5a..525900d 100644
--- a/src/components/molecules/modals/tooltip/tooltip.tsx
+++ b/src/components/molecules/modals/tooltip/tooltip.tsx
@@ -61,10 +61,12 @@ export const Tooltip: FC<TooltipProps> = ({
const tooltipClass = `${styles.tooltip} ${styles[directionModifier]} ${styles[visibilityModifier]} ${className}`;
const btnRef = useRef<HTMLButtonElement>(null);
- const closeModal = (target: Node) => {
- if (!onClickOutside) return;
-
- if (btnRef.current && !btnRef.current.contains(target)) {
+ const closeModal = ({ target }: MouseEvent | FocusEvent) => {
+ if (
+ onClickOutside &&
+ btnRef.current &&
+ !btnRef.current.contains(target as Node)
+ ) {
onClickOutside();
}
};