Page MenuHomePhabricator

D5471.diff
No OneTemporary

D5471.diff

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}
/>
<ClearSearchButton onClick={onClear} active={showClearButton} />
</div>
);
}
-export default Search;
+const ForwardedSearch: React.AbstractComponent<
+ Props,
+ HTMLInputElement,
+> = React.forwardRef<Props, HTMLInputElement>(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}
/>
<div className={css.contentContainer}>{threadPickerContent}</div>
</div>

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 6:33 AM (21 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2496694
Default Alt Text
D5471.diff (1 KB)

Event Timeline