Skip to content

Conversation

jcjp
Copy link
Contributor

@jcjp jcjp commented Sep 6, 2025

Description

  • Fixes: #21972
  • Check the model value if it's an empty string and treat it as a not dirty value
  • In this way we could show the placeholder from props

Markup:

<template>
  <v-app>
    <v-container>
      <v-combobox
        v-model="d"
        placeholder="placeholder"
        persistent-placeholder
        :items="['a','b','c']"
      />
    </v-container>
  </v-app>
</template>

<script setup>
  import { ref } from 'vue'

  const d = ref('')
</script>

@jcjp jcjp requested a review from a team September 6, 2025 15:32
@jcjp jcjp self-assigned this Sep 6, 2025
@jcjp jcjp added T: bug Functionality that does not work as intended/expected C: VCombobox labels Sep 6, 2025
@jcjp jcjp marked this pull request as ready for review September 6, 2025 15:34
@@ -477,7 +477,8 @@ export const VCombobox = genericComponent<new <
slots['append-item'] ||
slots['no-data']
)
const isDirty = model.value.length > 0
const isEmptyString = model.value.length === 1 && model.value[0].value === ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should rather be named isArrayWithEmptyString. Regardless... I don't think a combobox with multiple and model-value="['']" can be considered empty. It behaves differently when selecting more values. Showing placeholder in this case could be misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay gotcha, so this should be regarded as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VCombobox T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.9.6] v-combobox placeholder not showing initially if the model value is empty string
2 participants