Skip to content

Commit

Permalink
fix(VAutocomplete): hide selection slot when focused (#17294)
Browse files Browse the repository at this point in the history
Fixes #17291
  • Loading branch information
KaelWD committed May 8, 2023
1 parent de08cb5 commit 6885b43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,3 @@
.v-field--focused
.v-autocomplete__selection
opacity: 0

&--selection-slot
&.v-text-field input
position: relative
padding-inline-start: 0
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,7 @@ export const VAutocomplete = genericComponent<new <

isSelecting.value = true

if (!slots.selection) {
search.value = item.title
}
search.value = item.title

menu.value = false
isPristine.value = true
Expand All @@ -291,7 +289,7 @@ export const VAutocomplete = genericComponent<new <
watch(isFocused, val => {
if (val) {
isSelecting.value = true
search.value = props.multiple || !!slots.selection ? '' : String(selections.value.at(-1)?.props.title ?? '')
search.value = props.multiple ? '' : String(selections.value.at(-1)?.props.title ?? '')
isPristine.value = true

nextTick(() => isSelecting.value = false)
Expand Down Expand Up @@ -329,12 +327,11 @@ export const VAutocomplete = genericComponent<new <
onInput={ onInput }
class={[
'v-autocomplete',
`v-autocomplete--${props.multiple ? 'multiple' : 'single'}`,
{
'v-autocomplete--active-menu': menu.value,
'v-autocomplete--chips': !!props.chips,
'v-autocomplete--selecting-index': selectionIndex.value > -1,
[`v-autocomplete--${props.multiple ? 'multiple' : 'single'}`]: true,
'v-autocomplete--selection-slot': !!slots.selection,
},
props.class,
]}
Expand Down

0 comments on commit 6885b43

Please sign in to comment.