vuetify
vuetify copied to clipboard
[Bug Report][3.0.0-beta.2] v-combobox wrong modelValue and displayed text in v-text-field
Environment
Vuetify Version: 3.0.0-beta.2 Last working version: 2.6.4 Vue Version: 3.2.36 Browsers: Chrome 101.0.4951.67 OS: Windows
Steps to reproduce
- clone
- switch to branch v-combobox-model-value
-
npm i
-
npm run serve
- Open app in browser with console + Vue DevTools
- For the first and third combobox select one item, for the second and the fourth select two items
- Look at Vue DevTools, selected, selectedMultiple, selectedValue and selectedValues and the displayed texts on the v-text-field of v-combobox
Expected Behavior
The value for the 3rd input (using array of objects) should be .value And the display for the 4th input should be the titles
Actual Behavior
The 3rd input value is .title The 4th input display is .value
Reproduction Link
https://github.com/AntoninBeaufort/vuetify-combobox-rules/tree/v-combobox-model-value
Other comments
The problem only show up when items is an array of objects, not when it's an array of strings. Need to consider rules also when applying necessary updates #15142
I can confirm that the issue still happen in @vuetify/nightly: 3.0.0-next-20220529.0 but is a little bit different:
- In this nightly the 4th input display is correct (title)
- The problem on the 3rd input is still the same, the modelValue of VTextField is undefined whereas the modelValue of VCombobox is the title instead of the value
In 3.0.0-beta.4 the 3rd input (array of objects, single) have always the title for value, even if returnObject prop is true. In fact if returnObject is true (default) it should be { title: 'something', value: 'something' } and if false it should be the value, not title.
The 4th input is correct since https://github.com/vuetifyjs/vuetify/pull/15304
This is expected behavior, a single v-combobox
is basically a text-field, there is no difference between the model and the displayed text.
You can see the behavior you are looking for if you use v-select
or v-autocomplete
.
If you have any questions, please reach out to us in our Discord community.
We discussed this and decided it is actually a bug. "The 4th input display is .value" seems to already be fixed but
- single combobox with complex items
- should display item.title and emit the full object
- should not look up object items from primitives in the model