Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(Searchbar):fix-search-home-end-navigation

Aswin Asoka7f501384e2e
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 8e12b9ed5a..d2526655d8 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -383,9 +383,21 @@ const iconForOption = (option: SearchOption | undefined) => {
}
};
+const handleInputKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (
+ event,
+) => {
+ if (event.key === "Home" || event.key === "End") {
+ event.stopPropagation();
+ }
+};
+
// Keep the search text visible after react-select loses focus.
const Input: React.FC<InputProps<SearchOption, false>> = (props) => (
- <SelectComponents.Input {...props} isHidden={false} />
+ <SelectComponents.Input
+ {...props}
+ isHidden={false}
+ onKeyDown={handleInputKeyDown}
+ />
);
// noOptionsMessage must return null or react-select leaves an empty menu div.