Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: Improve key navigation in TypeaheadSelect and MultiTypeaheadSelect
In the TypeaheadSelect component, the focusedItemIndex is for the filteredSelections array, not for the selectOptions one. Thus without this fix, we would get the aria stuff wrong. We might even end up accessing non-existing items, when focusedItemIndex refers to a "No results found" fake entry in filteredSelections with index 0 while selectOptions is empty. The fake entries are now properly disabled and will be skipped by key navigation in both TypeaheadSelect and MultiTypeaheadSelect. Also, key navigation relies on there being at least one option that will not be skipped. Thus, we need to us isEnabledMenu instead of isMenu when deciding whether to return early. This got broken in 8d9f97b.
- Loading branch information