mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(select) aria-labelledby (#7022)
aria-labelledby must not be in the DOM if it is empty this causes accessability bugs.
This commit is contained in:
committed by
Andrew Seguin
parent
2129b7a7f9
commit
947d3e84d1
@@ -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');
|
||||
});
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user