Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(VMenu): check if element still exists before closing parent #20249

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

Arinono
Copy link
Contributor

@Arinono Arinono commented Jul 30, 2024

Description

fixes #20248

Instead of using the ! operator, I just added some null checks before using the overlay.value.contentEl.
I don't think it should cause any issue since the issue occurs when the view is completely destroyed (through the router in the reported case), so there is no cleanup to do anyways

Markup:

I used the same reproduction repo I provided in the issue to validate the changes:
https://github.com/Arinono/vuetify-vmenu-bug

<v-menu v-if="open" :close-on-content-click="false">
    <template #activator="{ props }">
      <v-btn v-bind="props">Open</v-btn>
    </template>
    <v-sheet class="pa-4">
      <div class="d-flex">
        <v-menu>
          <template #activator="{ props }">
            <v-btn style="display: block" v-bind="props">Sub menu</v-btn>
          </template>
          <v-sheet class="pa-4"> Click back in the input</v-sheet>
        </v-menu>
        <v-text-field style="width: 400px"></v-text-field>
      </div>
    </v-sheet>
  </v-menu>

  <router-link to="other-route" style="margin-left: 48px"> leave </router-link>

and used this section of the docs to test it

Co-authored-by: Kael <kaelwd@gmail.com>
@Arinono Arinono requested a review from KaelWD July 31, 2024 12:54
@KaelWD KaelWD changed the title fix(v-menu): closeParents on destroyed overlays fix(VMenu): check if element still exists before closing parent Jul 31, 2024
@KaelWD KaelWD merged commit 560362d into vuetifyjs:master Jul 31, 2024
10 checks passed
@KaelWD KaelWD added this to the v3.6.x milestone Jul 31, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.6.13] VMenu closeParents error
2 participants