Ionic-framework: menu can be opened on pages without menuToggle button

Created on 30 Nov 2016  路  4Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
Sliding from left opens menu on any page of app, doesn't matter if page has menuToggle button or not

Expected behavior:
Menu should open only on pages having menuToggle button in header

Steps to reproduce:
Download ionic-conference-app from google play store. Navigate to any child page and slide from left to open menu.

Related code:

<button ion-button menuToggle>
    <ion-icon name="menu"></ion-icon>
</button>

Only pages with above code should have slide from left to open menu.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Your system information:

Cordova CLI: 6.3.1 
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: 1.9.0 
ios-sim version: 5.0.8 
OS: macOS Sierra
Node Version: v6.3.1
Xcode version: Xcode 8.1 Build version 8B62

Most helpful comment

@manucorporat That only enable/disable menu on root page, enabling on root page enables on child page as well.
Let's take example of ionic-conference-app, we have menu on schedule page -

  1. We can swipe to open menu on Schedule page. That's expected as it has hamburger menu icon.
  2. Click any schedule item, it will push details page with back button on top left.
  3. Now swiping also opens menu. How can it be expected behavior to open menu when there is back button?

If that's the expected behavior, can you give me an example app? I checked Medium, Linkedin, Inbox app, none opens a menu when a page has back button.

All 4 comments

Well, that's not the expected behavior. It is up to you to decide when swipe is enabled or not. Use

<ion-menu [swipeEnabled]="menuEnabled"/>

@manucorporat That only enable/disable menu on root page, enabling on root page enables on child page as well.
Let's take example of ionic-conference-app, we have menu on schedule page -

  1. We can swipe to open menu on Schedule page. That's expected as it has hamburger menu icon.
  2. Click any schedule item, it will push details page with back button on top left.
  3. Now swiping also opens menu. How can it be expected behavior to open menu when there is back button?

If that's the expected behavior, can you give me an example app? I checked Medium, Linkedin, Inbox app, none opens a menu when a page has back button.

I tend to agree with @aggarwalankush. If a back button is present on the navigation bar I would expect swiping to the right to take me back, even if there is a menu.

However, the way I solved this in my situation @aggarwalankush was to just put the menu component at a lower level of the view hierarchy (because I didn't need it everywhere). So instead of putting the menu as a sibling of my root navigation controller and using it as the content, I put the menu component as a sibling of a child view's content. Fortunately I can re-use the contents of the menu If i need the menu anywhere else:

```





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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SebastianGiro picture SebastianGiro  路  3Comments

BilelKrichen picture BilelKrichen  路  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  路  3Comments

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  路  3Comments

aslamj picture aslamj  路  3Comments