Przeglądaj źródła

fix: prevent search menu from opening when dialog is open (#9279)

Sujal Gupta 2 miesięcy temu
rodzic
commit
56c05b3099

+ 4 - 0
packages/excalidraw/actions/actionToggleSearchMenu.ts

@@ -25,6 +25,10 @@ export const actionToggleSearchMenu = register({
     predicate: (appState) => appState.gridModeEnabled,
   },
   perform(elements, appState, _, app) {
+    if (appState.openDialog) {
+      return false;
+    }
+
     if (
       appState.openSidebar?.name === DEFAULT_SIDEBAR.name &&
       appState.openSidebar.tab === CANVAS_SEARCH_TAB

+ 4 - 0
packages/excalidraw/components/SearchMenu.tsx

@@ -297,6 +297,10 @@ export const SearchMenu = () => {
         event.preventDefault();
         event.stopPropagation();
 
+        if (app.state.openDialog) {
+          return;
+        }
+
         if (!searchInputRef.current?.matches(":focus")) {
           if (app.state.openDialog) {
             setAppState({