Select input text whenever open global search command UI

This commit is contained in:
Lim Chee Aun 2023-09-21 22:31:12 +08:00
parent 551de5a37c
commit 5661729748
2 changed files with 4 additions and 0 deletions

View file

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

View file

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