Skip to content

Commit

Permalink
fix(VMenu): allow enter keypress to work in input element (#19922)
Browse files Browse the repository at this point in the history
fixes #19920

Co-authored-by: John Leider <john@vuetifyjs.com>
  • Loading branch information
TIM56887 and johnleider authored Jun 11, 2024
1 parent 5b5bf50 commit 193301c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vuetify/src/components/VMenu/VMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ export const VMenu = genericComponent<OverlaySlots>()({
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(
Expand Down

0 comments on commit 193301c

Please sign in to comment.