Skip to content

Commit

Permalink
fix(VDateInput): remove menu interaction when disabled/readonly (#20163)
Browse files Browse the repository at this point in the history
fixes #20147

Co-authored-by: John Leider <[email protected]>
  • Loading branch information
SonTT19 and johnleider authored Jul 16, 2024
1 parent f0fa4e6 commit f970e5f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/vuetify/src/labs/VDateInput/VDateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export const VDateInput = genericComponent()({
return adapter.isValid(model.value) ? adapter.format(model.value, 'keyboardDate') : ''
})

const isInteractive = computed(() => !props.disabled && !props.readonly)

function onKeydown (e: KeyboardEvent) {
if (e.key !== 'Enter') return

Expand Down Expand Up @@ -105,12 +107,12 @@ export const VDateInput = genericComponent()({
<VTextField
{ ...textFieldProps }
modelValue={ display.value }
onKeydown={ onKeydown }
onKeydown={ isInteractive.value ? onKeydown : undefined }
focused={ menu.value || isFocused.value }
onFocus={ focus }
onBlur={ blur }
onClick:control={ onClick }
onClick:prepend={ onClick }
onClick:control={ isInteractive.value ? onClick : undefined }
onClick:prepend={ isInteractive.value ? onClick : undefined }
>
<VMenu
v-model={ menu.value }
Expand Down

0 comments on commit f970e5f

Please sign in to comment.