diff --git a/src/lib/button-toggle/button-toggle.spec.ts b/src/lib/button-toggle/button-toggle.spec.ts index 187ab4f15d33..85aa15bf275f 100644 --- a/src/lib/button-toggle/button-toggle.spec.ts +++ b/src/lib/button-toggle/button-toggle.spec.ts @@ -277,6 +277,15 @@ describe('MatButtonToggle without forms', () => { expect(buttonToggleInstances[0].checked).toBe(true); }); + it('should set aria-disabled based on whether the group is disabled', () => { + expect(groupNativeElement.getAttribute('aria-disabled')).toBe('false'); + + testComponent.isGroupDisabled = true; + fixture.detectChanges(); + + expect(groupNativeElement.getAttribute('aria-disabled')).toBe('true'); + }); + it('should update the group value when one of the toggles changes', () => { expect(groupInstance.value).toBeFalsy(); buttonToggleLabelElements[0].click(); diff --git a/src/lib/button-toggle/button-toggle.ts b/src/lib/button-toggle/button-toggle.ts index 23abf0513dbc..c84929eaf237 100644 --- a/src/lib/button-toggle/button-toggle.ts +++ b/src/lib/button-toggle/button-toggle.ts @@ -85,6 +85,7 @@ export class MatButtonToggleChange { host: { 'role': 'group', 'class': 'mat-button-toggle-group', + '[attr.aria-disabled]': 'disabled', '[class.mat-button-toggle-vertical]': 'vertical' }, exportAs: 'matButtonToggleGroup', @@ -98,7 +99,7 @@ export class MatButtonToggleGroup extends _MatButtonToggleGroupMixinBase impleme /** * Reference to the raw value that the consumer tried to assign. The real - * value will exaclude any values from this one that don't correspond to a + * value will exclude any values from this one that don't correspond to a * toggle. Useful for the cases where the value is assigned before the toggles * have been initialized or at the same that they're being swapped out. */