From 2930d9c40b6d0870d73dce5cd030f92d184100c6 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 19 Nov 2024 20:21:41 +0800 Subject: [PATCH] Try focus on search input again --- src/locales/en.po | 40 ++++++++++++++++++++-------------------- src/pages/search.jsx | 6 +++++- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/locales/en.po b/src/locales/en.po index e1dc335d..5321f1ae 100644 --- a/src/locales/en.po +++ b/src/locales/en.po @@ -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 "" diff --git a/src/pages/search.jsx b/src/pages/search.jsx index 00e74445..61deb3d2 100644 --- a/src/pages/search.jsx +++ b/src/pages/search.jsx @@ -184,12 +184,16 @@ function Search({ columnMode, ...props }) { }); useEffect(() => { + let timer; searchFormRef.current?.setValue?.(q || ''); if (q) { loadResults(true); } else { - searchFormRef.current?.focus?.(); + timer = setTimeout(() => { + searchFormRef.current?.focus?.(); + }, 150); // Right after focusDeck runs } + return () => clearTimeout(timer); }, [q, type, instance]); useHotkeys(