diff --git a/src/lib/select/select.spec.ts b/src/lib/select/select.spec.ts index 8a8bb96260d..93fafbcc1d1 100644 --- a/src/lib/select/select.spec.ts +++ b/src/lib/select/select.spec.ts @@ -1802,6 +1802,15 @@ describe('MatSelect', () => { expect(select.getAttribute('aria-labelledby')).toBe('myLabelId'); }); + it('should not have aria-labelledby in the DOM if it`s not specified', async(() => { + + fixture.detectChanges(); + + fixture.whenStable().then(() => { + expect(select.hasAttribute('aria-labelledby')).toBeFalsy(); + }); + })); + it('should set the tabindex of the select to 0 by default', () => { expect(select.getAttribute('tabindex')).toEqual('0'); }); diff --git a/src/lib/select/select.ts b/src/lib/select/select.ts index 8a5f3d46259..1a5038a9b5f 100644 --- a/src/lib/select/select.ts +++ b/src/lib/select/select.ts @@ -371,7 +371,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit, @Input('aria-label') ariaLabel: string = ''; /** Input that can be used to specify the `aria-labelledby` attribute. */ - @Input('aria-labelledby') ariaLabelledby: string = ''; + @Input('aria-labelledby') ariaLabelledby: string; /** Unique id of the element. */ @Input()