From 193301cb2d55ceacc4d2ef2cdbadf62c87675297 Mon Sep 17 00:00:00 2001 From: timmy <126319815+TIM56887@users.noreply.github.com> Date: Wed, 12 Jun 2024 02:00:18 +0800 Subject: [PATCH] fix(VMenu): allow enter keypress to work in input element (#19922) fixes #19920 Co-authored-by: John Leider --- packages/vuetify/src/components/VMenu/VMenu.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/vuetify/src/components/VMenu/VMenu.tsx b/packages/vuetify/src/components/VMenu/VMenu.tsx index 50fa611bbf6..b21ae402711 100644 --- a/packages/vuetify/src/components/VMenu/VMenu.tsx +++ b/packages/vuetify/src/components/VMenu/VMenu.tsx @@ -127,7 +127,11 @@ export const VMenu = genericComponent()({ if (props.disabled) return if (e.key === 'Tab' || (e.key === 'Enter' && !props.closeOnContentClick)) { - if (e.key === 'Enter' && e.target instanceof HTMLTextAreaElement) return + if ( + e.key === 'Enter' && + ((e.target instanceof HTMLTextAreaElement) || + (e.target instanceof HTMLInputElement && !!e.target.closest('form'))) + ) return if (e.key === 'Enter') e.preventDefault() const nextElement = getNextElement(