Skip to content

Commit f970e5f

Browse files
SonTT19johnleider
andauthored
fix(VDateInput): remove menu interaction when disabled/readonly (#20163)
fixes #20147 Co-authored-by: John Leider <john@vuetifyjs.com>
1 parent f0fa4e6 commit f970e5f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/vuetify/src/labs/VDateInput/VDateInput.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export const VDateInput = genericComponent()({
7171
return adapter.isValid(model.value) ? adapter.format(model.value, 'keyboardDate') : ''
7272
})
7373

74+
const isInteractive = computed(() => !props.disabled && !props.readonly)
75+
7476
function onKeydown (e: KeyboardEvent) {
7577
if (e.key !== 'Enter') return
7678

@@ -105,12 +107,12 @@ export const VDateInput = genericComponent()({
105107
<VTextField
106108
{ ...textFieldProps }
107109
modelValue={ display.value }
108-
onKeydown={ onKeydown }
110+
onKeydown={ isInteractive.value ? onKeydown : undefined }
109111
focused={ menu.value || isFocused.value }
110112
onFocus={ focus }
111113
onBlur={ blur }
112-
onClick:control={ onClick }
113-
onClick:prepend={ onClick }
114+
onClick:control={ isInteractive.value ? onClick : undefined }
115+
onClick:prepend={ isInteractive.value ? onClick : undefined }
114116
>
115117
<VMenu
116118
v-model={ menu.value }

0 commit comments

Comments
 (0)