bug: Menu: must have a "content" element to listen for drag events on.
See original GitHub issueBug Report
Ionic version: [x] 5.x
Current behavior:
Creating a Vue component with the ion-menu
ui component results in above error. Below code is from my Home.vue
, which is embedded in App.vue
, which has the ion-app
enclosing tags.
Expected behavior:
The ionic-menu
component would be displaying and clickable.
Steps to reproduce:
Unsure. I have different test applications with ion-menu
, and neither of them work.
Related code:
<template>
<ion-page>
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-menu-button
auto-hide="false"
menu="testmenu"
></ion-menu-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-menu menu-id="testmenu" content-id="mycontent">
<ion-content>
<ion-list>
<ion-item type="button">
<ion-label>Pokémon Yellow</ion-label>
</ion-item>
</ion-list>
</ion-content>
</ion-menu>
<ion-content id="mycontent"> Router Outlet </ion-content>
</ion-page>
</template>
<script>
import {
IonToolbar,
IonMenuButton,
IonButtons,
IonList,
IonItem,
IonMenu,
IonLabel,
IonContent,
IonHeader,
IonPage
} from "@ionic/vue";
import { defineComponent } from "vue";
export default defineComponent({
name: "App",
components: {
IonToolbar,
IonMenuButton,
IonButtons,
IonList,
IonItem,
IonMenu,
IonLabel,
IonContent,
IonHeader,
IonPage
},
});
</script>
<style scoped >
</style>
Other information: I have also tried the latest LTS version of node (14.x) with the latest npm, without any result.
Ionic:
Ionic CLI : 6.13.1 (/home/hans/.nvm/versions/node/v15.8.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 5.5.4
Capacitor:
Capacitor CLI : 2.4.6
@capacitor/core : 2.4.6
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v15.8.0 (/home/hans/.nvm/versions/node/v15.8.0/bin/node)
npm : 7.5.1
OS : Linux 5.8
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Menu: must have a 'content' element to listen for drag events ...
It works fine with one exception: when the page loads, there is the following error on the console: Error: "Menu: must have a...
Read more >Menu: must have a "content" element to listen for drag events ...
bug(v4-menu): Menu: must have a "content" element to listen for drag events on. Issue #15536 · ionic-team/ionic-framework · GitHub.
Read more >Menu: must have a “content” element to listen for drag events on
I created a menu component which has the menu-button and the ion-menu inside because i want to use this component on multiple pages....
Read more >Menu: must have a content'' element to listen for drag events on ...
Menu : must have a "content" element to listen for drag events on. import React from 'react'; import { IonMenu, IonHeader, IonToolbar, IonTitle,...
Read more >Making a Menu Work in Ionic 4 - Damir's Corner
Menu : must have a "content" element to listen for drag events on. It seemed to be related to opening the menu using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! The issue is here:
There seems to be some quirk with Vue 3 where mounting an app with Web Components too quickly causes issues. The reason why you are getting this error is Vue 3 is mounting
<ion-menu content-id="mycontent">
as<ion-menu contentid="mycontent">
(note the missing-
incontentid
).Normally waiting for the router to initialize first resolves the issue, but since you are not using the router you should try a
requestAnimationFrame
.Can you try the following and let me know if it resolves the issue?
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.