Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VMenu): allow enter keypress to work in input element #19922

Merged

Conversation

TIM56887
Copy link
Contributor

@TIM56887 TIM56887 commented May 30, 2024

Description

fixes #19920 prevent Enter default only for inputs in forms

Markup:

<template>
  <v-app>
    <v-container>
      <v-btn id="rootButton"> Open Menu 1 </v-btn>
      <v-menu
        v-model="menu1"
        :close-on-content-click="false"
        activator="#rootButton"
        height="300px"
        location="top"
        width="260px"
        persistent
      >
        <v-form @submit="submit">
          <v-card>
            <v-card-title> Menu 1 </v-card-title>
            <v-card-item>
              <v-row>
                <v-col cols="12">
                  <v-text-field v-model="menu1Text" label="Some text" />
                </v-col>
              </v-row>
            </v-card-item>
            <v-card-actions>
              <v-spacer />

              <v-btn variant="text"> Cancel </v-btn>
              <v-btn color="primary" variant="text" type="submit"> Save </v-btn>
            </v-card-actions>
          </v-card>
        </v-form>
      </v-menu>
    </v-container>
  </v-app>
</template>

<script setup lang="ts">
  import { Ref, ref } from 'vue'

  const menu1: Ref<boolean> = ref(false)
  const menu1Text: Ref<string> = ref('')
  const submit = () => console.log('submitted')
</script>

@TIM56887 TIM56887 closed this May 30, 2024
@TIM56887 TIM56887 reopened this May 30, 2024
@TIM56887 TIM56887 force-pushed the fix/19920-v-menu-prevents-form-submit branch from e182187 to b6a966b Compare May 30, 2024 14:53
@johnleider johnleider added T: bug Functionality that does not work as intended/expected C: VMenu VMenu labels Jun 11, 2024
@johnleider johnleider added this to the v3.6.x milestone Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VMenu VMenu T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.6.7] V-Menu prevents form submit when user presses Enter key in a text-input field
2 participants