diff --git a/plugins/search/src/components/SearchBar/SearchBar.stories.tsx b/plugins/search/src/components/SearchBar/SearchBar.stories.tsx index 27a739006a..72b8429026 100644 --- a/plugins/search/src/components/SearchBar/SearchBar.stories.tsx +++ b/plugins/search/src/components/SearchBar/SearchBar.stories.tsx @@ -71,7 +71,9 @@ export const Focused = () => { - + {/* decision up to adopter, read https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md#no-autofocus */} + {/* eslint-disable-next-line jsx-a11y/no-autofocus */} + diff --git a/plugins/search/src/components/SearchBar/SearchBar.tsx b/plugins/search/src/components/SearchBar/SearchBar.tsx index 5d503c5c44..c1730bfcff 100644 --- a/plugins/search/src/components/SearchBar/SearchBar.tsx +++ b/plugins/search/src/components/SearchBar/SearchBar.tsx @@ -30,11 +30,11 @@ type PresenterProps = { onSubmit?: () => void; className?: string; placeholder?: string; - focused?: boolean; + autoFocus?: boolean; }; export const SearchBarBase = ({ - focused, + autoFocus, value, onChange, onSubmit, @@ -42,13 +42,6 @@ export const SearchBarBase = ({ placeholder: overridePlaceholder, }: PresenterProps) => { const configApi = useApi(configApiRef); - const inputRef = useRef(); - - useEffect(() => { - if (focused) { - inputRef?.current?.focus(); - } - }, [focused]); const onKeyDown = React.useCallback( (e: KeyboardEvent) => { @@ -69,7 +62,9 @@ export const SearchBarBase = ({ return ( {