Skip to content

Commit

Permalink
lib: Adapt TypeaheadSelect and MultiTypeaheadSelect to key navigation…
Browse files Browse the repository at this point in the history
… changes

The new PF version will move the keyboard focus into the SelectList of
a opened Select when the user presses ArrowUp or ArrowDown
keys. Further keyboard navigation then happens by moving the focus
around in that list.

However, TypeaheadSelect and MultiTypeaheadSelect templated implement
their own custom keyboard navigation based on the (now broken)
assumption that the text input stays in focus all the time.

To restore the assumption, Select has a new "typeahead" variant that
switches off its new key handling, letting the Typeahead templates
live in the past for a little while longer.

See patternfly/patternfly-react#11249
  • Loading branch information
mvollmer authored and martinpitt committed Dec 10, 2024
1 parent aea1989 commit 6514a32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/lib/cockpit-components-multi-typeahead-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
!isOpen && closeMenu();
}}
toggle={toggle}
shouldFocusFirstItemOnOpen={false}
variant="typeahead"
ref={innerRef}
{...props}
>
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/cockpit-components-typeahead-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export const TypeaheadSelectBase: React.FunctionComponent<TypeaheadSelectProps>
onSelect={_onSelect}
onOpenChange={(isOpen) => !isOpen && closeMenu()}
toggle={toggle}
shouldFocusFirstItemOnOpen={false}
variant="typeahead"
ref={innerRef}
{...props}
>
Expand Down

0 comments on commit 6514a32

Please sign in to comment.