diff --git a/.changeset/slimy-garlics-wash.md b/.changeset/slimy-garlics-wash.md new file mode 100644 index 00000000000..0b2afb519f8 --- /dev/null +++ b/.changeset/slimy-garlics-wash.md @@ -0,0 +1,5 @@ +--- +"@primer/react": patch +--- + +ActionMenu: Fix typeahead with leading visuals diff --git a/src/hooks/useTypeaheadFocus.ts b/src/hooks/useTypeaheadFocus.ts index 727e077861c..7cc20ab701f 100644 --- a/src/hooks/useTypeaheadFocus.ts +++ b/src/hooks/useTypeaheadFocus.ts @@ -49,7 +49,7 @@ export const useTypeaheadFocus = (open: boolean, providedRef?: React.RefObject { const itemsStartingWithKey = focusableItems.filter(item => { - return item.textContent?.toLowerCase().startsWith(query) + return item.textContent?.toLowerCase().trim().startsWith(query) }) const currentActiveIndex = itemsStartingWithKey.indexOf(activeElement)