diff --git a/src/components/menu/_menu.js b/src/components/menu/_menu.js index fdc3e15f035..1cbc4245b90 100644 --- a/src/components/menu/_menu.js +++ b/src/components/menu/_menu.js @@ -22,8 +22,9 @@ angular.module('material.components.menu', [ * * Every `md-menu` must specify exactly two child elements. The first element is what is * left in the DOM and is used to open the menu. This element is called the trigger element. - * The trigger element's scope has access to `$mdOpenMenu()` - * which it may call to open the menu. + * The trigger element's scope has access to `$mdOpenMenu($event)` + * which it may call to open the menu. By passing $event as argument, the + * corresponding event is stopped from propagating up the DOM-tree. * * The second element is the `md-menu-content` element which represents the * contents of the menu when it is open. Typically this will contain `md-menu-item`s, @@ -32,7 +33,7 @@ angular.module('material.components.menu', [ * * * - * + * * * * @@ -74,7 +75,7 @@ angular.module('material.components.menu', [ * * * - * + * * * * @@ -117,7 +118,7 @@ angular.module('material.components.menu', [ * @usage * * - * + * * * * @@ -190,7 +191,9 @@ function MenuController($mdMenu, $attrs, $element, $scope) { }; // Uses the $mdMenu interim element service to open the menu contents - this.open = function openMenu() { + this.open = function openMenu(ev) { + ev && ev.stopPropagation(); + ctrl.isOpen = true; triggerElement.setAttribute('aria-expanded', 'true'); $mdMenu.show({ diff --git a/src/components/menu/demoBasicUsage/index.html b/src/components/menu/demoBasicUsage/index.html index 559d7556c7b..46eae11dda9 100644 --- a/src/components/menu/demoBasicUsage/index.html +++ b/src/components/menu/demoBasicUsage/index.html @@ -4,7 +4,7 @@

Simple dropdown menu

Note that applying the md-menu-origin and md-menu-align-target attributes ensure that the menu elements align

- + diff --git a/src/components/menu/demoMenuPositionModes/index.html b/src/components/menu/demoMenuPositionModes/index.html index 17b938b9678..9078de377ca 100644 --- a/src/components/menu/demoMenuPositionModes/index.html +++ b/src/components/menu/demoMenuPositionModes/index.html @@ -7,7 +7,7 @@

Target-Based Position Modes

Target Mode Positioning (default)

- + @@ -23,7 +23,7 @@

Target-Based Position Modes

Target mode with md-offset

- + @@ -36,7 +36,7 @@

Target-Based Position Modes

md-position-mode="target-right target"

- + diff --git a/src/components/menu/demoMenuWidth/index.html b/src/components/menu/demoMenuWidth/index.html index 56f1db8cba9..6cb13c07e45 100644 --- a/src/components/menu/demoMenuWidth/index.html +++ b/src/components/menu/demoMenuWidth/index.html @@ -6,7 +6,7 @@

Different Widths

Wide menu (width=6)

- + @@ -19,7 +19,7 @@

Different Widths

Medium menu (width=4)

- + @@ -32,7 +32,7 @@

Different Widths

Small menu (width=2)

- + diff --git a/src/components/menu/menu.spec.js b/src/components/menu/menu.spec.js index 718e207bb8d..bffa553bf6f 100644 --- a/src/components/menu/menu.spec.js +++ b/src/components/menu/menu.spec.js @@ -15,7 +15,7 @@ describe('md-menu directive', function() { inject(function($compile, $rootScope) { menu = $compile([ '', - '', + '', '', '
  • ', '
    '