Skip to content

Conversation

@J-Sek
Copy link
Contributor

@J-Sek J-Sek commented Sep 10, 2025

Description

  • suppress focus trap when focusin is triggered shortly after pointerdown
  • avoids scrolling up as well as the missing focus bug when clicking the field
  • keeps hover-menu open on clicked input

fixes #21775
fixes #20569
fixes #21015
fixes #16819

Markup:

Scenario for `stick-to-target` scroll bug and VSelect interaction
<template>
  <v-app theme="dark">
    <v-container>
      <div class="d-flex ga-5">
        <v-btn color="green">
          Just a menu on top
          <v-menu activator="parent" stick-to-target>
            <v-list :items="items" border />
          </v-menu>
        </v-btn>
        <v-spacer />
      </div>
      <div v-for="i in 30" :key="i">Lorem ipsum dolor sit</div>
      <v-select :items="items" />
      <div v-for="i in 30" :key="i">Lorem ipsum dolor sit</div>
      <v-btn color="green">
        Just a menu on bottom
        <v-menu activator="parent" stick-to-target>
          <v-list :items="items" border />
        </v-menu>
      </v-btn>
    </v-container>
  </v-app>
</template>

<script setup>
  const items = Array.from({ length: 5 }, (_, i) => `Item #${i + 1}`)
</script>
Hover menu should not prevent other menu from closing
<template>
  <v-app theme="dark">
    <v-container>
      <!--Button Component-->
      <v-btn color="primary">
        Action Button
        <v-menu activator="parent">
          <v-card>Action Info</v-card>
        </v-menu>
      </v-btn>

      <!--Input component-->
      <v-text-field style="margin-top: 20px">
        <v-menu
          :close-on-content-click="false"
          activator="parent"
          open-on-hover
        >
          Hover Action Menu
        </v-menu>
      </v-text-field>
    </v-container>
  </v-app>
</template>

@J-Sek J-Sek requested a review from KaelWD September 10, 2025 20:55
@J-Sek J-Sek self-assigned this Sep 10, 2025
@J-Sek J-Sek added T: bug Functionality that does not work as intended/expected C: VMenu labels Sep 10, 2025
@KaelWD KaelWD force-pushed the master branch 4 times, most recently from 142b234 to bb54746 Compare September 12, 2025 09:01
@github-actions
Copy link
Contributor

🚀 Nightly release published to @vuetify/[email protected].

@J-Sek J-Sek force-pushed the fix/vmenu-suppress-focus-trap branch from 65d0c5f to ed6cdc8 Compare October 6, 2025 16:49
@Cephaz
Copy link

Cephaz commented Oct 10, 2025

I noticed a couple of tests that could perhaps be made a bit 😄


replace: await expect.poll(() => selectedItems.value).toHaveLength(0)

await userEvent.click(screen.getAllByRole('option')[0])

add: await expect.poll(() => screen.queryByRole('listbox')).toBeNull()

@J-Sek J-Sek added this to the v3.10.x milestone Oct 17, 2025
@J-Sek J-Sek force-pushed the fix/vmenu-suppress-focus-trap branch from ed6cdc8 to f2c927c Compare October 21, 2025 14:44
@J-Sek
Copy link
Contributor Author

J-Sek commented Oct 21, 2025

@Cephaz, they seem somewhat stable atm, but I will keep this tip in mind. Thanks 👍🏼

@J-Sek J-Sek merged commit d1dafff into vuetifyjs:master Oct 21, 2025
10 checks passed
@J-Sek J-Sek deleted the fix/vmenu-suppress-focus-trap branch October 21, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment