Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3247736
D5471.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5471.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D5471: [web] focus search input for thread picker modal
Attached
Detach File
Event Timeline
Log In to Comment