Select input text whenever open global search command UI

pull/228/head
Lim Chee Aun 2023-09-21 22:31:12 +08:00
rodzic 551de5a37c
commit 5661729748
2 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -16,6 +16,7 @@ export default memo(function SearchCommand({ onClose = () => {} }) {
setShowSearch(true);
setTimeout(() => {
searchFormRef.current?.focus?.();
searchFormRef.current?.select?.();
}, 0);
},
{

Wyświetl plik

@ -23,6 +23,9 @@ const SearchForm = forwardRef((props, ref) => {
focus: () => {
searchFieldRef.current.focus();
},
select: () => {
searchFieldRef.current.select();
},
blur: () => {
searchFieldRef.current.blur();
},