Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(select): wrong option amount being read out by NVDA #5181

Merged
merged 1 commit into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/lib/select/select.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<div class="mat-select-trigger" cdk-overlay-origin (click)="toggle()" #origin="cdkOverlayOrigin" #trigger>
<div
cdk-overlay-origin
class="mat-select-trigger"
aria-hidden="true"
(click)="toggle()"
#origin="cdkOverlayOrigin"
#trigger>
<span
class="mat-select-placeholder"
[class.mat-floating-placeholder]="_selectionModel.hasValue()"
Expand Down
9 changes: 9 additions & 0 deletions src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,15 @@ describe('MdSelect', () => {
expect(document.activeElement).toBe(select, 'Expected select element to be focused.');
});

// Having `aria-hidden` on the trigger avoids issues where
// screen readers read out the wrong amount of options.
it('should set aria-hidden on the trigger element', () => {
const trigger = fixture.debugElement.query(By.css('.mat-select-trigger')).nativeElement;

expect(trigger.getAttribute('aria-hidden'))
.toBe('true', 'Expected aria-hidden to be true when the select is open.');
});

});

describe('for options', () => {
Expand Down