From ce311136ef22fea89305c0bf9d524b6e3095dde5 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Thu, 3 Aug 2017 00:50:40 +0200 Subject: [PATCH] fix(select): set aria-multiselectable for multi-select (#6110) Sets the `aria-multiselectable` attribute to multi-select instances, as per https://www.w3.org/TR/wai-aria-practices-1.1/#Listbox. --- src/lib/select/select.spec.ts | 15 +++++++++++++++ src/lib/select/select.ts | 1 + 2 files changed, 16 insertions(+) diff --git a/src/lib/select/select.spec.ts b/src/lib/select/select.spec.ts index 2b00b161f9d..61fe0f517b9 100644 --- a/src/lib/select/select.spec.ts +++ b/src/lib/select/select.spec.ts @@ -1915,6 +1915,21 @@ describe('MdSelect', () => { .toBe('true', 'Expected aria-hidden to be true when the select is open.'); }); + it('should set `aria-multiselectable` to true on multi-select instances', () => { + fixture.destroy(); + + const multiFixture = TestBed.createComponent(MultiSelect); + + multiFixture.detectChanges(); + select = multiFixture.debugElement.query(By.css('md-select')).nativeElement; + + expect(select.getAttribute('aria-multiselectable')).toBe('true'); + }); + + it('should set `aria-multiselectable` false on single-selection instances', () => { + expect(select.getAttribute('aria-multiselectable')).toBe('false'); + }); + }); describe('for options', () => { diff --git a/src/lib/select/select.ts b/src/lib/select/select.ts index 989d79db053..7a53b46b53c 100644 --- a/src/lib/select/select.ts +++ b/src/lib/select/select.ts @@ -164,6 +164,7 @@ export const _MdSelectMixinBase = mixinColor(mixinDisabled(MdSelectBase), 'prima '[attr.aria-disabled]': 'disabled.toString()', '[attr.aria-invalid]': '_isErrorState()', '[attr.aria-owns]': '_optionIds', + '[attr.aria-multiselectable]': 'multiple', '[class.mat-select-disabled]': 'disabled', '[class.mat-select-invalid]': '_isErrorState()', '[class.mat-select-required]': 'required',