moroshko / react-autosuggest

WAI-ARIA compliant React autosuggest component

Home Page:http://react-autosuggest.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] highlightedSectionIndex does not reset to null when highlightFirstSuggestion changes from true to false

DoloMike opened this issue · comments

highlightedSectionIndex does not reset to null when highlightFirstSuggestion changes from true to false

stackblitz example for reproducing the issue

Steps to reproduce the issue (and observed behavior):

  1. Focus on the input field (at this point highlightFirstSuggestion === false and nothing is highlighted).
  2. Type c, and wait for suggestions to appear (at this point highlightFirstSuggestion === true and the first suggestion is highlighted).
  3. Press backspace so the input is empty (at this point highlightFirstSuggestion === false and the first suggestion remains highlighted).

captured

Expected behaviour:

When highlightFirstSuggestion === false nothing should be highlighted. highlightedSectionIndex should be set back to null.