Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report][3.7.3] v-combobox placeholder is not consistent with v-textbox #20660

Open
giuliohome opened this issue Nov 2, 2024 · 3 comments · May be fixed by #20737
Open

[Bug Report][3.7.3] v-combobox placeholder is not consistent with v-textbox #20660

giuliohome opened this issue Nov 2, 2024 · 3 comments · May be fixed by #20737
Labels
C: VAutocomplete VAutocomplete C: VCombobox VCombobox good first issue A quick-win fix that would be great for new contributors T: bug Functionality that does not work as intended/expected

Comments

@giuliohome
Copy link

Environment

Vuetify Version: 3.7.3
Vue Version: 3.5.12
Browsers: Google Chrome, Microsoft Edge
OS: Windows, Linux

Steps to reproduce

A placeholder bound to an empty but non null model value

Expected Behavior

The combobx placeholder should show up as the v-text-field placeholder does

Actual Behavior

The placeholder remains hidden instead and strictly requires a null

Reproduction Link

https://play.vuetifyjs.com/#...

@MatthewAry MatthewAry added T: bug Functionality that does not work as intended/expected C: VCombobox VCombobox good first issue A quick-win fix that would be great for new contributors and removed S: triage labels Nov 14, 2024
@MatthewAry
Copy link
Contributor

May be related to #17122

@giuliohome
Copy link
Author

giuliohome commented Nov 26, 2024

Based on the playground, it appears that the regression was introduced in Vuetify 3.1.14 and was not present in 3.1.13 for the v-combobox.

And from 3.0.0-beta.9 to 3.0.0-beta.10 for the v-autocomplete.

@giuliohome
Copy link
Author

giuliohome commented Nov 26, 2024

Also the wrapInArray can be problematic, especially in conjunction with the logic around the model.value and how the empty values are handled. For null or undefined, wrapInArray returns an empty array []. When v is an empty string '', the wrapInArray function will wrap it in an array, i.e., wrapInArray('') will return ['']. So, if model.value is set to an array with an empty string [''], it won't trigger the same behavior as an empty model []. This can lead to the placeholder logic being broken because the model value isn't truly empty even if the input visually appears empty.

I see this already mentioned here but it was not related to v-combobox. However, the current problem with the v-combobox is that (here):

placeholder={ isDirty ? undefined : props.placeholder }

will incorrectly result in undefined for the placeholder when the model is initially empty. This contradicts the logic in onUpdateModelValue which correctly resets the model.value to [] also when v === ''.

Possible Fix (to be tested and verified):

const isDirty = model.value.length > 0 && !(model.value[0].value === '' && model.value.length === 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VAutocomplete VAutocomplete C: VCombobox VCombobox good first issue A quick-win fix that would be great for new contributors T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants