Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(material/select): fix VoiceOver confused by ARIA semantics
For Select component, fix issues where VoiceOver was confused by the ARIA semantics of the combobox. Fix multiple behaviors: - Fix VoiceOver focus ring stuck on the combobox while navigating options. - Fix VoiceOver would sometimes reading option as a TextNode and not communicating the selected state and position in set. - Fix VoiceOver "flickering" behavior where VoiceOver would display one announcement then quickly change to another annoucement. Also fix the same issues for Autocomplete component. Implement fix by doing two things. First, move the aria-owns reference to the overlay from the child of the combobox to the parent modal of the comobobx. Having an aria-owns reference inside the combobox element seemed to confuse VoiceOver. Second, apply `aria-hidden="true"` to the ripple element and pseudo checkboxes on mat-option. These DOM nodes are only used for visual purposes, so it is most appropriate to remove them from the accessibility tree. This seemed to make VoiceOver's behavior more consistent. Fix #23202, #19798
- Loading branch information
Showing
15 changed files
with
249 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
<mat-pseudo-checkbox *ngIf="multiple" class="mat-mdc-option-pseudo-checkbox" | ||
[state]="selected ? 'checked' : 'unchecked'" [disabled]="disabled"></mat-pseudo-checkbox> | ||
<mat-pseudo-checkbox *ngIf="multiple" class="mat-mdc-option-pseudo-checkbox" [disabled]="disabled" | ||
[state]="selected ? 'checked' : 'unchecked'" [attr.aria-hidden]="'true'"></mat-pseudo-checkbox> | ||
|
||
<ng-content select="mat-icon"></ng-content> | ||
|
||
<span class="mdc-list-item__primary-text" #text><ng-content></ng-content></span> | ||
|
||
<!-- Render checkmark at the end for single-selection. --> | ||
<mat-pseudo-checkbox *ngIf="!multiple && selected && !hideSingleSelectionIndicator" | ||
class="mat-mdc-option-pseudo-checkbox" state="checked" [disabled]="disabled" | ||
appearance="minimal"></mat-pseudo-checkbox> | ||
class="mat-mdc-option-pseudo-checkbox" [disabled]="disabled" state="checked" | ||
[attr.aria-hidden]="'true'" appearance="minimal"></mat-pseudo-checkbox> | ||
|
||
<!-- See a11y notes inside optgroup.ts for context behind this element. --> | ||
<span class="cdk-visually-hidden" *ngIf="group && group._inert">({{ group.label }})</span> | ||
|
||
<div class="mat-mdc-option-ripple mat-mdc-focus-indicator" mat-ripple | ||
[matRippleTrigger]="_getHostElement()" | ||
[matRippleDisabled]="disabled || disableRipple"> | ||
<div class="mat-mdc-option-ripple mat-mdc-focus-indicator" [attr.aria-hidden]="'true'" mat-ripple | ||
[matRippleTrigger]="_getHostElement()" [matRippleDisabled]="disabled || disableRipple"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.