Skip to content

[autocomplete] highlighted index doesn't get reset if options length is unchanged #40184

@ViktorZhurbin

Description

@ViktorZhurbin

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://stackblitz.com/edit/react-taee4w?file=Demo.tsx

Steps:

  1. With empty input box, use kb arrows to select 3rd option and hit Enter
  2. Press arrow down and observe which option is highlighted

Current behavior 😯

4th option is highlighted

Expected behavior 🤔

1st option should be highlighted

Context 🔦

If you remove limit from createFilterOptions, it works as expected. Likely connected to the deps array of syncHighlightedIndex which includes filteredOptions.length

Your environment 🌎

No response

Metadata

Metadata

Assignees

Labels

scope: autocompleteChanges related to the autocomplete. This includes ComboBox.type: bugIt doesn't behave as expected.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions