Skip to content

Commit 30d2443

Browse files
committed
Autofocus search on home page
1 parent 6f220d1 commit 30d2443

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

.changelog/2398.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Autofocus search on home page

src/app/components/Search/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ export interface SearchProps {
1919
disabled?: boolean
2020
onFocusChange?: (hasFocus: boolean) => void
2121
expandable?: boolean
22+
autoFocus?: boolean
2223
}
2324

2425
export const Search: FC<SearchProps> = ({
2526
scope,
2627
expandable,
2728
disabled,
2829
onFocusChange: onFocusChangeProp,
30+
autoFocus,
2931
}) => {
3032
const { t } = useTranslation()
3133
const navigate = useNavigate()
@@ -86,6 +88,7 @@ export const Search: FC<SearchProps> = ({
8688
)}
8789
size="lg"
8890
onChange={onChange}
91+
autoFocus={autoFocus}
8992
onFocus={() => onFocusChange(true)}
9093
onBlur={() => onFocusChange(false)}
9194
placeholder={searchPlaceholderTranslated}

src/app/pages/HomePage/HomeSearch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const HomeSearch: FC = () => {
2525
{t('home.search')}
2626
</Typography>
2727

28-
<Search disabled={!isApiReachable} />
28+
<Search disabled={!isApiReachable} autoFocus />
2929
</div>
3030
)
3131
}

0 commit comments

Comments
 (0)