AutoComplete component does not permit programatic focus override via wrapped Listbox
Issue summary
There is a disconnect between a user's selected option index within an <AutoComplete />'s <ListBox /> and the matched value input within <ComboBox />. Essentially, if you have an ordered array of default options passed to the <AutoComplete /> (ie. Size, Color, Material, Style) and you manually type out one of those options into the <ComboBox />'s text input (ie. Color), the focus state should (at least be able to) shift to the matching option.
Expected behaviour
The <ListBox />'s focused option should ideally shift to the matched value from the <ComboBox /> input. If we decide this shouldn't be the default, we should at least be able to programatically shift the focus of the <ListBox /> options. I could see us doing this a few ways:
a. automatically shift focus to the matched input between <ComboBox /> and <ListBox />
b. add a some flavour of a focusedOption or focusedIndex prop to <AutoComplete />
c. add a listBox prop to <AutoComplete /> allowing the user to override the default implementation (like we do with textField)
Actual behaviour
If you have an <Autocomplete /> with the default options of Size, Color, Material, Style, and you type out Material in the text field, and then hit the ENTER key, even though the Material field is visibly selected / given a highlighted style, it's in fact the Size option that get's submitted, because no change in focus gets accounted for when the <ComboBox /> text input matches a <ListBox /> option.
Steps to reproduce the problem
- In Shopify admin, open up a product page with variants
- Click on
Add another option, and type outMaterial(this input is case-sensitive) - See that
Materialbecomes visually selected in the<ListBox /> - Hit
ENTERon your keyboard - Notice that
Sizeget's selected (the first<ListBox />option with focus) instead ofMaterial
Screenshot

Specifications
- Are you using the React components? (Y/N): Yes
- Polaris version number: Latest
- Browser: Chrome
- Device: M1
- Operating System: OSX
Hi! We noticed there hasn’t been activity on this issue in a while. After 30 days, it will close automatically.
If it’s still relevant, or you have updates, comment and let us know. And don’t worry, you can always re-open later if needed.