UiSelect: disable scroll to top when using multiple#439
UiSelect: disable scroll to top when using multiple#439plakak wants to merge 1 commit intoJosephusPaye:nextfrom plakak:fix-ui-select-filter-scroll
Conversation
|
Hi @plakak, Thanks for the PR. I think we reset the highlighted option (and scroll) because the current highlighted option may not be available after the filter. So if We may need to find a way to prevent |
|
Hi @JosephusPaye, After a long debugging session I found the problem. Apparently if one adds object directly in the template like this <ui-select
label="Favourite colours"
multiple
:keys="{label: 'label', value: 'value'}"
:options="colours"
v-model="select7"
></ui-select>on each model change vue recreates this object and prop gets updated. I've tested this on a simple component of my own and it happens. If one would get keys from data like Since it's really convenient to add keys directly in the template I think the library should walkaround this -compare keys internally and change them only if the value changed and not just reference. |
Fixes #437.
Each time
filteredOptionsreturns a new object the watcher is fired and scrolls to the top.As far as I can tell this behavior is desirable mostly when using search (especially async). When new items are fetched scroll should return to the top. It might be desirable in some other situations with custom filters.
But I can't see any use case of scroll to top when
multipleis chosen. I've excluded it in that scenario.