Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit d203d72

Browse files
committed
fix(menu): ensure menu button is type=button
closes #3821
1 parent 976e0f4 commit d203d72

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/components/menu/_menu.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function MenuDirective($mdMenu) {
151151
triggerElement = triggerElement.querySelector('[ng-click]');
152152
}
153153
triggerElement && triggerElement.setAttribute('aria-haspopup', 'true');
154+
triggerElement.setAttribute('type', 'button');
154155
if (templateElement.children().length != 2) {
155156
throw Error('Invalid HTML for md-menu. Expected two children elements.');
156157
}

src/components/menu/menu.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,18 @@ describe('md-menu directive', function () {
2323
expect(buildBadMenu).toThrow();
2424
}));
2525

26+
2627
it('removes everything but the first element', function () {
2728
var menu = setup()[0];
2829
expect(menu.children.length).toBe(1);
2930
expect(menu.firstElementChild.nodeName).toBe('BUTTON');
3031
});
3132

33+
iit('specifies button type', inject(function($compile, $rootScope) {
34+
var menu = setup()[0];
35+
expect(menu.firstElementChild.getAttribute('type')).toBe('button');
36+
}));
37+
3238
it('opens on click', function () {
3339
var menu = setup();
3440
openMenu(menu);

0 commit comments

Comments
 (0)