]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18776 Fix input focus on the dropdown
authorKevin Silva <kevin.silva@sonarsource.com>
Mon, 27 Mar 2023 12:08:04 +0000 (14:08 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 27 Mar 2023 20:03:03 +0000 (20:03 +0000)
server/sonar-web/design-system/src/components/InputSearch.tsx

index 1d86d98131db7f9d2e4c1c42db38a8a2f2492353..ba7ee3cd6e64c40c3e114d01f6a9dedf0a3f2123 100644 (file)
@@ -91,6 +91,12 @@ export default function InputSearch({
     }
   }, [parentValue]);
 
+  useEffect(() => {
+    if (autoFocus && input.current) {
+      input.current.focus();
+    }
+  });
+
   const changeValue = (newValue: string) => {
     if (newValue.length === 0 || !minLength || minLength <= newValue.length) {
       debouncedOnChange(newValue);
@@ -135,7 +141,6 @@ export default function InputSearch({
         <input
           aria-label={searchInputAriaLabel}
           autoComplete="off"
-          autoFocus={autoFocus}
           className={inputClassName}
           maxLength={maxLength}
           onBlur={onBlur}