diff --git a/web/components/search.react.js b/web/components/search.react.js
--- a/web/components/search.react.js
+++ b/web/components/search.react.js
@@ -12,7 +12,7 @@
+placeholder?: string,
};
-function Search(props: Props): React.Node {
+function Search(props: Props, ref): React.Node {
const { searchText, onChangeText, placeholder } = props;
const showClearButton = !!searchText;
@@ -39,10 +39,16 @@
value={searchText}
type="text"
placeholder={placeholder}
+ ref={ref}
/>
);
}
-export default Search;
+const ForwardedSearch: React.AbstractComponent<
+ Props,
+ HTMLInputElement,
+> = React.forwardRef(Search);
+
+export default ForwardedSearch;
diff --git a/web/modals/threads/thread-picker-modal.react.js b/web/modals/threads/thread-picker-modal.react.js
--- a/web/modals/threads/thread-picker-modal.react.js
+++ b/web/modals/threads/thread-picker-modal.react.js
@@ -69,6 +69,12 @@
new Set(),
);
+ const searchRef = React.useRef();
+
+ React.useEffect(() => {
+ searchRef.current?.focus();
+ });
+
const onChangeSearchText = React.useCallback(
(text: string) => {
const results = searchIndex.getSearchResults(text);
@@ -126,6 +132,7 @@
onChangeText={onChangeSearchText}
searchText={searchText}
placeholder="Search chats"
+ ref={searchRef}
/>
{threadPickerContent}