Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(photos): disable search while Settings is open

Aswin Asok9836885f1789
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 54d0d820c3..3739ea3579 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -63,6 +63,7 @@ import AsyncSelect from "react-select/async";
export interface SearchBarProps {
isInSearchMode: boolean;
+ isSettingsOpen: boolean;
onSelectSearchOption: (
o: SearchOption | undefined,
options?: { shouldExitSearchMode?: boolean },
@@ -97,6 +98,8 @@ export const SearchBar: React.FC<SearchBarProps> = (props) => {
};
useEffect(() => {
+ if (props.isSettingsOpen) return;
+
const handleKeyDown = (event: KeyboardEvent) => {
if ((event.metaKey || event.ctrlKey) && event.key === "k") {
event.preventDefault();
@@ -106,7 +109,7 @@ export const SearchBar: React.FC<SearchBarProps> = (props) => {
document.addEventListener("keydown", handleKeyDown);
return () => document.removeEventListener("keydown", handleKeyDown);
- }, []);
+ }, [props.isSettingsOpen]);
const closeButton = isSmallWidth && props.isInSearchMode && (
<Tooltip title={t("close")}>
@@ -125,6 +128,7 @@ export const SearchBar: React.FC<SearchBarProps> = (props) => {
color="secondary"
aria-label={t("search")}
aria-haspopup="dialog"
+ disabled={props.isSettingsOpen}
onClick={showSearch}
sx={{
minWidth: 0,
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 77d726330a..6943fe5ddb 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1984,6 +1984,7 @@ const Page: React.FC = () => {
showRail
showNormalNavigation={showNormalNavigation}
isInSearchMode={isInSearchMode}
+ isSettingsOpen={sidebarVisibilityProps.open}
mode={barMode}
onChangeMode={handleChangeBarMode}
onSidebar={showSidebar}