Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes a bug which I noticed in the
lion-combobox
component. First I will describe a bug and then there will be a section with explanation regarding the PR itself.Bug description
Autocomplete feature is not being stable in multiple cases.
Case 1
Steps to reproduce
Validation
section)m
and wait untilMango
autocompletion happenso
and wait until autocompletion disappearsmo
m
and wait untilMango
autocompletion happenso
and wait until autocompletion disappearsEnter
Actual result
The autocomplete feature replaces
mo
toMango
Expected result
Autocompletion should not happen since there are no words in the combobox list which starts from
mo
A gif with example
Case 2
Steps to reproduce
Validation
section)m
and wait untilMango
autocompletion happensa
and wait untilMango
autocompletion happensk
and wait until autocompletion disappearsEnter
Actual result
The autocomplete feature replaces
mak
toMango
Expected result
Autocompletion should not happen since there are no words in the combobox list which starts from
mak
A gif with example
Pull request description
To fix the issue the
activeIndex
of thelion-combobox
should be set to-1
every time the unselection happens.Note this is not the first iteration of the PR. I tried different approaches which might be more appropriate but those require more code updates and possible breaking changes which I don't want to bring without a discussion. F.e. there is a piece of existing code which sets
activeIndex
to-1
on every popup opening which meansskip any active for all elements
, but at the same time there is a unit test which tests settingactive
property programmatically before opening the popup. It seems this test doesn't make much sense forlion-combobox
since any the active elements become non-active as soon as a popup opens. So supporting active state with closed combobox might be not a best idea.If not having active elements with closed combobox is ok, then _handleAutocompletion might not be called on initial setup. Then only thing it does before opening a combobox popup is setting
activeIndex
(this can be ditched) and reset the model (this can be moved to another function).Anyways we can discuss this and I can explain what I mean exactly in details.