Przeglądaj źródła

fix search input blur

AykutSarac 2 lat temu
rodzic
commit
393cd7ec59
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      src/components/Graph/index.tsx

+ 6 - 0
src/components/Graph/index.tsx

@@ -79,6 +79,11 @@ const MemoizedGraph = React.memo(function Layout({
     }
   }, []);
 
+  const onCanvasClick = React.useCallback(() => {
+    const input = document.querySelector("input:focus") as HTMLInputElement;
+    if (input) input.blur();
+  }, []);
+
   React.useEffect(() => {
     const { nodes, edges } = parser(json, expand);
 
@@ -111,6 +116,7 @@ const MemoizedGraph = React.memo(function Layout({
             maxHeight={size.height}
             direction={layout}
             onLayoutChange={onLayoutChange}
+            onCanvasClick={onCanvasClick}
             key={layout}
             zoomable={false}
             animated={false}