1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-13 04:34:13 +02:00

Fix: google translate extenstion close side panel (#4625)

* Fix gtx-trans close sidepanel

* reset the package-lock.json file
This commit is contained in:
Abdelrhman Kamal
2023-10-24 16:19:53 +03:00
committed by GitHub
parent 4f3b891e45
commit 309cf3d6d9
2 changed files with 4 additions and 2 deletions

2
package-lock.json generated
View File

@@ -11025,4 +11025,4 @@
} }
} }
} }
} }

View File

@@ -3,7 +3,9 @@ import { useEffect } from 'react';
export function useOutsideClick(ref: any, callback: any) { export function useOutsideClick(ref: any, callback: any) {
useEffect(() => { useEffect(() => {
const listener = (event: any) => { const listener = (event: any) => {
const isClickedOutside = !ref?.current?.contains(event.target); const isClickedOutside =
!ref?.current?.contains(event.target) &&
!document?.getElementById('gtx-trans')?.contains(event.target);
if (isClickedOutside) { if (isClickedOutside) {
callback(); callback();
} }