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

fix(VTextField): remain placeholder after values selected #16565

Conversation

gitemad
Copy link
Contributor

@gitemad gitemad commented Feb 1, 2023

Description

Fix placeholder remains displayed when selecting items in components like VCombobox and VAutoComplete.
I solve this issue using isDirty value in VTextField component.

fixes #16519
fixes #16493

Markup:

VAutoComplete

<template>
  <v-app>
    <v-main>
         <v-autocomplete
            v-model="values"
            :items="items"
            placeholder="Select Item"
            multiple
          ></v-autocomplete>
    </v-main>
  </v-app>
</template>
<script>
  export default {
    data: () => ({
      items: ['foo', 'bar', 'fizz', 'buzz'],
      values: ['foo', 'bar'],
    }),
  }
</script>

VCombobox

<template>
  <v-app>
    <v-container>
      <v-combobox
        v-model="select"
        :items="items"
        label="I use chips"
        multiple
        placeholder="asdfasdfasdf"
        chips
      ></v-combobox>
    </v-container>
  </v-app>
</template>

<script>
export default {
  data () {
      return {
        select: ['Vuetify', 'Programming'],
        items: [
          'Programming',
          'Design',
          'Vue',
          'Vuetify',
        ],
      }
    },
}
</script>

fixes vuetifyjs#16519
fixes vuetifyjs#16493
Fix placeholder remains displayed when selecting items in components like VCombobox and VAutoComplete
@gitemad gitemad force-pushed the fix/16519-16493-remain-placeholder-when-values-selected branch from 3628849 to b90c5d4 Compare February 9, 2023 05:41
@johnleider johnleider assigned johnleider and gitemad and unassigned johnleider Feb 15, 2023
@johnleider johnleider self-requested a review February 15, 2023 15:36
@johnleider johnleider added T: bug Functionality that does not work as intended/expected C: VSelect VSelect labels Feb 15, 2023
@johnleider
Copy link
Member

Can you also try to resolve the Select placeholder issue as part of this PR?

<template>
  <v-app>
    <v-main>
      <v-autocomplete
        v-model="values"
        :items="items"
        label="Autocomplete"
        placeholder="Select Item"
        multiple
      />

      <v-combobox
        v-model="values"
        :items="items"
        label="Combobox"
        multiple
        placeholder="asdfasdfasdf"
      />

      <v-select
        v-model="values"
        :items="items"
        label="Select"
        multiple
        placeholder="asdfasdfasdf"
      />

    </v-main>
  </v-app>
</template>
<script>
  export default {
    data: () => ({
      items: ['foo', 'bar', 'fizz', 'buzz'],
      values: [],
    }),
  }
</script>

@gitemad
Copy link
Contributor Author

gitemad commented Feb 28, 2023

Can you also try to resolve the Select placeholder issue as part of this PR?

<template>
  <v-app>
    <v-main>
      <v-autocomplete
        v-model="values"
        :items="items"
        label="Autocomplete"
        placeholder="Select Item"
        multiple
      />

      <v-combobox
        v-model="values"
        :items="items"
        label="Combobox"
        multiple
        placeholder="asdfasdfasdf"
      />

      <v-select
        v-model="values"
        :items="items"
        label="Select"
        multiple
        placeholder="asdfasdfasdf"
      />

    </v-main>
  </v-app>
</template>
<script>
  export default {
    data: () => ({
      items: ['foo', 'bar', 'fizz', 'buzz'],
      values: [],
    }),
  }
</script>

Sure. I fixed it.

@gitemad gitemad force-pushed the fix/16519-16493-remain-placeholder-when-values-selected branch from fac4be4 to 57a81ed Compare February 28, 2023 10:06
@johnleider
Copy link
Member

Sure. I fixed it.

persistent-placeholder is now broken:

<template>
  <v-app>
    <v-main>
      <v-autocomplete
        v-model="values"
        :items="items"
        label="Autocomplete"
        placeholder="Select Item"
        :multiple="multiple"
        persistent-placeholder
      />

      <v-combobox
        v-model="values"
        :items="items"
        label="Combobox"
        :multiple="multiple"
        placeholder="asdfasdfasdf"
        persistent-placeholder
      />

      <v-select
        v-model="values"
        :items="items"
        label="Select"
        :multiple="multiple"
        placeholder="asdfasdfasdf"
        persistent-placeholder
      />

    </v-main>
  </v-app>
</template>
<script>
  export default {
    data: () => ({
      items: ['foo', 'bar', 'fizz', 'buzz'],
      multiple: true,
      values: [],
    }),
  }
</script>

@gitemad
Copy link
Contributor Author

gitemad commented Feb 28, 2023

Sure. I fixed it.

persistent-placeholder is now broken:

<template>
  <v-app>
    <v-main>
      <v-autocomplete
        v-model="values"
        :items="items"
        label="Autocomplete"
        placeholder="Select Item"
        :multiple="multiple"
        persistent-placeholder
      />

      <v-combobox
        v-model="values"
        :items="items"
        label="Combobox"
        :multiple="multiple"
        placeholder="asdfasdfasdf"
        persistent-placeholder
      />

      <v-select
        v-model="values"
        :items="items"
        label="Select"
        :multiple="multiple"
        placeholder="asdfasdfasdf"
        persistent-placeholder
      />

    </v-main>
  </v-app>
</template>
<script>
  export default {
    data: () => ({
      items: ['foo', 'bar', 'fizz', 'buzz'],
      multiple: true,
      values: [],
    }),
  }
</script>

Fixed.

Copy link
Member

@johnleider johnleider left a comment

Choose a reason for hiding this comment

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

Everything looks good except the unrelated changes to the package.json files. Can you remove them please?

@gitemad gitemad requested a review from johnleider March 24, 2023 12:11
@gitemad
Copy link
Contributor Author

gitemad commented Mar 26, 2023

Everything looks good except the unrelated changes to the package.json files. Can you remove them please?

I fixed the conflicts.

@johnleider johnleider added this to the v3.1.x milestone Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VSelect VSelect T: bug Functionality that does not work as intended/expected
Projects
None yet
2 participants