Skip to content

Commit

Permalink
fix(VMenu): prevent Enter default only for inputs in forms
Browse files Browse the repository at this point in the history
  • Loading branch information
TIM56887 committed May 30, 2024
1 parent 1dc350d commit b6a966b
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 b6a966b

Please sign in to comment.