Skip to content

Commit 1d4496e

Browse files
committed
update mdc-based menu
1 parent 1fc8a6f commit 1d4496e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/material-experimental/mdc-menu/menu.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<ng-template>
22
<div
33
class="mat-mdc-menu-panel mdc-menu-surface mdc-menu-surface--open"
4+
[id]="panelId"
45
[ngClass]="_classList"
56
(keydown)="_handleKeydown($event)"
67
(click)="closed.emit('click')"

src/material-experimental/mdc-menu/menu.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ describe('MatMenu', () => {
7474
overlayContainer.ngOnDestroy();
7575
}));
7676

77+
it('should aria-controls the menu panel', () => {
78+
const fixture = createComponent(SimpleMenu, [], [FakeIcon]);
79+
fixture.detectChanges();
80+
fixture.componentInstance.trigger.openMenu();
81+
fixture.detectChanges();
82+
expect(fixture.componentInstance.triggerEl.nativeElement.getAttribute('aria-controls'))
83+
.toBe(fixture.componentInstance.menu.panelId);
84+
});
85+
7786
it('should open the menu as an idempotent operation', () => {
7887
const fixture = createComponent(SimpleMenu, [], [FakeIcon]);
7988
fixture.detectChanges();

0 commit comments

Comments
 (0)