ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.01k stars 13.51k forks source link

bug: SideMenu not working #21087

Closed Rehan1579 closed 4 years ago

Rehan1579 commented 4 years ago

Bug Report

Ionic version:

[x] 5.x

Current behavior: I’ve been using ionic-core 4 in my project, everything was working fine, Few days ago, i migrated to ionic5, everything worked great (on latest browsers) after doing some minor changes, but my SideMenustopped working. I noticed ionic5 implementation(way of use) for SideMenu totally replaced ionic4.

Expected behavior: Need backward compatible, ionic5 SideMenu should also be working easily like it was in ionic4.

Steps to reproduce:

Related code:

Ionic 4 Example:
----------------

const menuCtrl = document.querySelector('ion-menu-controller');

function openFirst() {
  menuCtrl.enable(true, 'first');
  menuCtrl.open('first');
}

Ionic 5 Example:
----------------

<script type="module">
    import { menuController } from '@ionic/core';
    window.menuController = menuController;
</script>

function openFirst() {
    menuController.enable(true, 'first');
    menuController.open('first');
}

Other information: You see, the actual functions are same like open/enable etc but the way you gonna import SideMenu has changed. For some reasons, my (clients) project needs to run on old browsers which dont support import/module.

So is there a way to run ionic5 SideMenu on old browsers too like ionic4 was ??? Client's project, need to support old browsers too

Ionic info:

IonicCore 5.0.5
VanillaJS
Goggle Chorme v51+
liamdebeasi commented 4 years ago

Thanks for the issue. You can call the open method on the ion-menu element itself.

CodePen: https://codepen.io/liamdebeasi/pen/WNQGKVw

For more information please see https://ionicframework.com/docs/api/menu.

ionitron-bot[bot] commented 4 years ago

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.