Explorar el Código

focus after changing scope

Yuki Takei hace 4 años
padre
commit
1932638070
Se han modificado 1 ficheros con 16 adiciones y 2 borrados
  1. 16 2
      packages/app/src/components/Navbar/GlobalSearch.tsx

+ 16 - 2
packages/app/src/components/Navbar/GlobalSearch.tsx

@@ -70,10 +70,24 @@ const GlobalSearch: FC<Props> = (props: Props) => {
             {scopeLabel}
           </button>
           <div className="dropdown-menu">
-            <button className="dropdown-item" type="button" onClick={() => setScopeChildren(false)}>
+            <button
+              className="dropdown-item"
+              type="button"
+              onClick={() => {
+                setScopeChildren(false);
+                globalSearchFormRef.current?.focus();
+              }}
+            >
               { t('header_search_box.item_label.All pages') }
             </button>
-            <button className="dropdown-item" type="button" onClick={() => setScopeChildren(true)}>
+            <button
+              className="dropdown-item"
+              type="button"
+              onClick={() => {
+                setScopeChildren(true);
+                globalSearchFormRef.current?.focus();
+              }}
+            >
               { t('header_search_box.item_label.This tree') }
             </button>
           </div>