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

deleted, closed #20741

Conversation

giuliohome
Copy link

fixes: #20718

Description

As per my comment here, I have deleted the problematic if condition and I have also tested again the reproduction (non regression) of #19929 in the playground reported below

Markup:

<template>
  <v-app>
    <v-container>
      <v-autocomplete
        v-model="selection"
        :items="items"
        clearable
        placeholder="select a item"
      ></v-autocomplete>
      <v-btn @click="myResetAction">reset</v-btn>
      <v-autocomplete
        v-model="selected"
        :items="items2"
        auto-select-first
        clearable
      ></v-autocomplete>
      <span>Selected: {{ selected }}</span>
    </v-container>    
  </v-app>
</template>

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

  const selection = ref()
  const items = ref(['itemA', 'itemB'])

  const items2 = ref(['Option 1', 'Option 2', 'Option 3'])

  const selected = ref(null)

  const myResetAction = () => {
    selection.value = undefined
  }
</script>

@J-Sek
Copy link
Contributor

J-Sek commented Nov 27, 2024

It will revert the fix for #19543 but I think it is fine. To suppress unnecessary server calls devs should keep track of the menu state with v-model:menu="isMenuOpen" and abort processing if menu is closed (it may need additional debounce, but I guess it would be there anyway).

This playground illustrates my point.

Previous implementation also was handling very narrow case. User can select "Item A", type additional letters and then blur. The resulting search is null and is set back to "Item A" on focus. For the fix to be consistent it would need to reset search to the model on blur... but then it is not a result of user typing and we are in the square one - trying to bend to invalid expectations.

I vote for this PR to be merged and additional example in the docs for "lazy" suggestions.

@J-Sek J-Sek requested a review from yuwu9145 November 27, 2024 21:28
@J-Sek J-Sek added T: bug Functionality that does not work as intended/expected C: VAutocomplete VAutocomplete labels Nov 27, 2024
@giuliohome-org giuliohome-org closed this by deleting the head repository Nov 29, 2024
@giuliohome giuliohome changed the title fix(VAutocomplete): placeholder missing deleted, closed Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VAutocomplete VAutocomplete 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.7.4] v-autocomplete placeholder text missing after manual reset
3 participants