Try focus on search input again

This commit is contained in:
Lim Chee Aun 2024-11-19 20:21:41 +08:00
parent 6ebf5bd1c9
commit 2930d9c40b
2 changed files with 25 additions and 21 deletions

40
src/locales/en.po generated
View file

@ -97,8 +97,8 @@ msgstr "Following"
#: src/components/account-info.jsx:421
#: src/components/account-info.jsx:778
#: src/pages/account-statuses.jsx:484
#: src/pages/search.jsx:323
#: src/pages/search.jsx:470
#: src/pages/search.jsx:327
#: src/pages/search.jsx:474
msgid "Posts"
msgstr ""
@ -956,8 +956,8 @@ msgstr ""
#: src/components/generic-accounts.jsx:145
#: src/components/notification.jsx:438
#: src/pages/accounts.jsx:41
#: src/pages/search.jsx:313
#: src/pages/search.jsx:346
#: src/pages/search.jsx:317
#: src/pages/search.jsx:350
msgid "Accounts"
msgstr ""
@ -965,14 +965,14 @@ msgstr ""
#: src/components/timeline.jsx:519
#: src/pages/list.jsx:293
#: src/pages/notifications.jsx:848
#: src/pages/search.jsx:540
#: src/pages/search.jsx:544
#: src/pages/status.jsx:1332
msgid "Show more…"
msgstr ""
#: src/components/generic-accounts.jsx:210
#: src/components/timeline.jsx:524
#: src/pages/search.jsx:545
#: src/pages/search.jsx:549
msgid "The end."
msgstr ""
@ -1079,7 +1079,7 @@ msgstr ""
#: src/components/shortcuts-settings.jsx:52
#: src/components/shortcuts-settings.jsx:179
#: src/pages/search.jsx:45
#: src/pages/search.jsx:295
#: src/pages/search.jsx:299
msgid "Search"
msgstr ""
@ -2697,7 +2697,7 @@ msgstr ""
#: src/pages/catchup.jsx:1316
#: src/pages/mentions.jsx:147
#: src/pages/search.jsx:308
#: src/pages/search.jsx:312
msgid "All"
msgstr ""
@ -3301,42 +3301,42 @@ msgstr ""
msgid "Search: {q}"
msgstr ""
#: src/pages/search.jsx:318
#: src/pages/search.jsx:400
#: src/pages/search.jsx:322
#: src/pages/search.jsx:404
msgid "Hashtags"
msgstr ""
#: src/pages/search.jsx:350
#: src/pages/search.jsx:404
#: src/pages/search.jsx:474
#: src/pages/search.jsx:354
#: src/pages/search.jsx:408
#: src/pages/search.jsx:478
msgid "See more"
msgstr ""
#: src/pages/search.jsx:376
#: src/pages/search.jsx:380
msgid "See more accounts"
msgstr ""
#: src/pages/search.jsx:390
#: src/pages/search.jsx:394
msgid "No accounts found."
msgstr ""
#: src/pages/search.jsx:446
#: src/pages/search.jsx:450
msgid "See more hashtags"
msgstr ""
#: src/pages/search.jsx:460
#: src/pages/search.jsx:464
msgid "No hashtags found."
msgstr ""
#: src/pages/search.jsx:504
#: src/pages/search.jsx:508
msgid "See more posts"
msgstr ""
#: src/pages/search.jsx:518
#: src/pages/search.jsx:522
msgid "No posts found."
msgstr ""
#: src/pages/search.jsx:562
#: src/pages/search.jsx:566
msgid "Enter your search term or paste a URL above to get started."
msgstr ""

View file

@ -184,12 +184,16 @@ function Search({ columnMode, ...props }) {
});
useEffect(() => {
let timer;
searchFormRef.current?.setValue?.(q || '');
if (q) {
loadResults(true);
} else {
timer = setTimeout(() => {
searchFormRef.current?.focus?.();
}, 150); // Right after focusDeck runs
}
return () => clearTimeout(timer);
}, [q, type, instance]);
useHotkeys(