Skip to content

[Bug Report][3.11.6] Closing parent menu can be triggered if content changed dimensions #22488

Description

@Glandos

Environment

Vuetify Version: 3.11.6
Vue Version: 3.5.26
OS: Linux undefined (current)

Steps to reproduce

  1. Click on "First activator"
  2. Click on "Second activator"
  3. Click on "Big content"

Expected Behavior

First menu shouldn't close when clicking on "Big content"

Actual Behavior

First menu closes

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

"Big content" is only shown when "Second menu" is visible.
Click on "First menu" leads to the correct behavior, i.e. second menu closes but not the first.

This is caused by https://github.com/vuetifyjs/vuetify/blame/v3.11.6/packages/vuetify/src/components/VMenu/VMenu.tsx#L95

  1. The isClickInsideElement is called after a setTimeout
  2. Since "Big content" was hidden, coordinates used in https://github.com/vuetifyjs/vuetify/blob/v3.11.6/packages/vuetify/src/util/helpers.ts#L738 are now outside of menu content
  3. It detects that menu is closed

Calling isClickInsideElement before setTimeout() should fix this, but I'm not sure why the setTimeout was used in the first place. The initial PR (#15018) doesn't talk about it, and next contributors used it as is.

Metadata

Metadata

Assignees

Labels

C: VMenuT: bugFunctionality that does not work as intended/expected

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions