Vuetify: [Bug Report] VAutocomplete broken suggestions if the value match input

Created on 25 Jan 2019  路  3Comments  路  Source: vuetifyjs/vuetify

Versions and Environment

Vuetify: 1.4.3
Vue: 2.5.22
Browsers: Chrome 71.0.3578.98
OS: Linux x86_64

Steps to reproduce

define a prefix filter for VAutocomplete like this:

methods: {
  filter: (item, queryText, itemText) => itemText.startsWith(queryText)
}

suppose, items containing values, some of which are the prefix for others

data() {
  return {
    items: ["bar", "baz", "foo", "foo-bar", "foo-baz", "foo-foo"],
    val: ""
  };
}

in this example "foo" is the prefix for "foo-bar", "foo-baz", "foo-foo")

If for such autocomplete element first select "foo", so that the value will be "foo", then edit the input to "fo" and then to "foo" again, then suggested items are incorrect: all of items (unfiltered) are shown and none of them is highlighted.

Expected Behavior

Instead of all items just items, which prefixed by "foo" must be shown.

Actual Behavior

But the item list is not filtered and none of items is highlighted.

Reproduction Link

https://codesandbox.io/s/32xn42o03q

Other comments

The issue occurs due to the check (this.internalSearch !== this.getText(this.selectedItem)) in the function isSearching of components/VAutocomplete/VAutocomplete.js at the line 120:

isSearching: function isSearching() {
  if (this.multiple) return this.searchIsDirty;
  return this.searchIsDirty && this.internalSearch !== this.getText(this.selectedItem);
}
VAutocomplete bug

Most helpful comment

I may go ahead and give this one a shot

All 3 comments

I may go ahead and give this one a shot

After further discussion with the team / community. The PR that altered this is being considered breaking. Re-opening.

I can give this another go and put behind a prop. Are there any suggestions/preferred naming to use here?

Was this page helpful?
0 / 5 - 0 ratings