-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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(VField): stopPropagation mousedown event on clearable icon #16945
Conversation
I changed the implementation logic slightly. In addition to stopping propagation, I prevent default so that when a selects menu is open and cleared, it won't hide the menu then re-open it. I moved the logic to open the menu as a side-effect of the search computed property changing the state of menu into the _search watcher. Since onClear causes 2 changes: value to null to '', I wait for the nextTick to update the value of cleared so as not to open the menu when open-on-clear is false. Checked clearing each field while not focused, focused, and focused with the menu open. <template>
<v-app>
<v-main class="pa-8 w-50">
<v-card color="success" class="d-flex flex-column w-100" title=":open-on-clear=true">
<v-autocomplete
v-model="item[3]"
:items="items"
hide-details="auto"
:clearable="true"
label="autocomplete"
:open-on-clear="true"
/>
<v-select
v-model="item[4]"
:items="items"
hide-details="auto"
:clearable="true"
label="select"
:open-on-clear="true"
/>
<v-combobox
v-model="item[5]"
:items="items"
hide-details="auto"
:clearable="true"
label="combobox"
:open-on-clear="true"
/>
</v-card>
<v-card color="error" class="d-flex flex-column w-100" title=":open-on-clear=false">
<v-autocomplete
v-model="item[6]"
:items="items"
hide-details="auto"
:clearable="true"
label="autocomplete"
:open-on-clear="false"
/>
<v-select
v-model="item[7]"
:items="items"
hide-details="auto"
:clearable="true"
label="select"
:open-on-clear="false"
/>
<v-combobox
v-model="item[8]"
:items="items"
hide-details="auto"
:clearable="true"
label="combobox"
:open-on-clear="false"
/>
</v-card>
</v-main>
</v-app>
</template>
<script setup>
import { ref } from 'vue'
const item = ref([...Array(9).keys()])
const items = ref([1, 2, 3, 4, 5, 6, 7, 8, 9])
</script> |
New implementation works really good, it does resolve the issue. Couple of comments:
|
I tried/experimented my old solution of using Since Kael mentioned #15907, it means Probably we should try to refactor that Thanks for your help! For this issue, I give this PR an approve 👍 |
fixes #16925
Description
fixes #16925
Markup: