Skip to content

Commit 494335f

Browse files
mvollmermartinpitt
authored andcommitted
lib: Adapt TypeaheadSelect and MultiTypeaheadSelect to key navigation 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
1 parent daa728f commit 494335f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/lib/cockpit-components-multi-typeahead-select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
361361
!isOpen && closeMenu();
362362
}}
363363
toggle={toggle}
364-
shouldFocusFirstItemOnOpen={false}
364+
variant="typeahead"
365365
ref={innerRef}
366366
{...props}
367367
>

pkg/lib/cockpit-components-typeahead-select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ export const TypeaheadSelectBase: React.FunctionComponent<TypeaheadSelectProps>
508508
onSelect={_onSelect}
509509
onOpenChange={(isOpen) => !isOpen && closeMenu()}
510510
toggle={toggle}
511-
shouldFocusFirstItemOnOpen={false}
511+
variant="typeahead"
512512
ref={innerRef}
513513
{...props}
514514
>

0 commit comments

Comments
 (0)