diff --git a/src/components/Actions.tsx b/src/components/Actions.tsx index b7144e15..2fe1701c 100644 --- a/src/components/Actions.tsx +++ b/src/components/Actions.tsx @@ -184,7 +184,7 @@ export const ShapesSwitcher = ({ ); })} void; onRemoveFromLibrary: (index: number) => void; onInsertShape: (elements: LibraryItem) => void; onAddToLibrary: (elements: LibraryItem) => void; @@ -211,7 +210,13 @@ const LibraryMenu = ({ setAppState: React.Component["setState"]; }) => { const ref = useRef(null); - useOnClickOutside(ref, onClickOutside); + useOnClickOutside(ref, (event) => { + // If click on the library icon, do nothing. + if ((event.target as Element).closest(".ToolIcon_type_button__library")) { + return; + } + onClickOutside(event); + }); const [libraryItems, setLibraryItems] = useState([]); @@ -269,7 +274,6 @@ const LibraryMenu = ({ ) : (