Ionic-framework: Ionic 2 - menuToggle breaks navbar when there are more than one button in the <ion-buttons>

Created on 2 May 2016  路  6Comments  路  Source: ionic-team/ionic-framework

<ion-navbar hideBackButton *navbar>
  <ion-buttons start>
    <button>
      <ion-icon light name="ios-home-outline"></ion-icon>
    </button>
  </ion-buttons>

  <ion-title> Home </ion-title>

  <ion-buttons end>
    <button>
      <ion-icon light name="ios-search-outline"></ion-icon>
    </button>
    <button menuToggle>
      <ion-icon light name="ios-menu-outline"></ion-icon>
    </button>
  </ion-buttons>
</ion-navbar>

The code above breaks the navbar when the menuToggle is inserted in one of the buttons from <ion-buttons>. It only happens when there are two or more buttons in the <ion-buttons>

Solution found:

.bar-button-menutoggle {
     display: inline;
}

This fix the bug. Don't know if it's the better way to do that.

reply

Most helpful comment

Hey @gustavobatista901, buttons with the menuToggle directive shouldn't be placed in the ion-buttons element. This is something we should probably document better, but this is how it should be written:

<ion-navbar hideBackButton *navbar>
  <ion-buttons start>
    <button>
      <ion-icon name="ios-home-outline"></ion-icon>
    </button>
  </ion-buttons>

  <ion-title> Home </ion-title>

  <ion-buttons end>
    <button>
      <ion-icon name="ios-search-outline"></ion-icon>
    </button>
  </ion-buttons>
  <button menuToggle end>
    <ion-icon name="ios-menu-outline"></ion-icon>
  </button>
</ion-navbar>

All 6 comments

Hello! Thanks for opening an issue with us! Would you mind making a plunker or codepen that gives an example of this issue?

Hey @gustavobatista901, buttons with the menuToggle directive shouldn't be placed in the ion-buttons element. This is something we should probably document better, but this is how it should be written:

<ion-navbar hideBackButton *navbar>
  <ion-buttons start>
    <button>
      <ion-icon name="ios-home-outline"></ion-icon>
    </button>
  </ion-buttons>

  <ion-title> Home </ion-title>

  <ion-buttons end>
    <button>
      <ion-icon name="ios-search-outline"></ion-icon>
    </button>
  </ion-buttons>
  <button menuToggle end>
    <ion-icon name="ios-menu-outline"></ion-icon>
  </button>
</ion-navbar>

I created an issue to improve the documentation for this: https://github.com/driftyco/ionic-site/issues/590

Thanks @brandyscarney

@brandyscarney can you please give an example code for, two menuToggle buttons on opposite sides in the same navbar ?

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

alexbainbridge picture alexbainbridge  路  3Comments

gio82 picture gio82  路  3Comments

manucorporat picture manucorporat  路  3Comments

alan-agius4 picture alan-agius4  路  3Comments

vswarte picture vswarte  路  3Comments