Skip to content

Commit

Permalink
focus input on first click (keycloak#34283)
Browse files Browse the repository at this point in the history
fixes: keycloak#34054

Signed-off-by: Erik Jan de Wit <[email protected]>
  • Loading branch information
edewit authored Oct 25, 2024
1 parent 4d25128 commit b57b0be
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ export const TypeaheadSelectControl = <
render={({ field }) => (
<Select
{...rest}
onClick={() => setOpen(!open)}
onOpenChange={() => setOpen(false)}
selected={
isSelectBasedOptions(options)
Expand All @@ -173,12 +172,16 @@ export const TypeaheadSelectControl = <
.map((o) => o.value)
: field.value
}
shouldFocusFirstItemOnOpen={false}
toggle={(ref) => (
<MenuToggle
ref={ref}
id={id || name.slice(name.lastIndexOf(".") + 1)}
variant="typeahead"
onClick={() => setOpen(!open)}
onClick={() => {
setOpen(!open);
textInputRef.current?.focus();
}}
isExpanded={open}
isFullWidth
status={get(errors, name) ? MenuToggleStatus.danger : undefined}
Expand Down

0 comments on commit b57b0be

Please sign in to comment.