Skip to content

Commit

Permalink
refactor(select): use aria-activedescendant to manage focus
Browse files Browse the repository at this point in the history
* Refactors the select to use `aria-activedescendant` to announce the highlighted item to screen readers. Previously we would this through focus, however using focus prevents us from being able to do things like angular#3211.
* Fixes a hack that was used to get a hold of the panel element using `querySelector`. Now it properly uses a `ViewChild` query, however this meant some tests had to be updated.

Relates to angular#3211.
Fixes angular#6690.
  • Loading branch information
crisbeto committed Sep 23, 2017
1 parent 3571f68 commit a518536
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 216 deletions.
7 changes: 5 additions & 2 deletions src/lib/select/select.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@
(detach)="close()">

<div
#panel
class="mat-select-panel {{ 'mat-' + color }}"
[ngClass]="panelClass"
[@transformPanel]="multiple ? 'showing-multiple' : 'showing'"
(@transformPanel.done)="_onPanelDone()"
(keydown)="_handlePanelKeydown($event)"
[style.transformOrigin]="_transformOrigin"
[class.mat-select-panel-done-animating]="_panelDoneAnimating"
[style.font-size.px]="_triggerFontSize">

<div class="mat-select-content" [@fadeInContent]="'showing'" (@fadeInContent.done)="_onFadeInDone()">
<div
class="mat-select-content"
[@fadeInContent]="'showing'"
(@fadeInContent.done)="_onFadeInDone()">
<ng-content></ng-content>
</div>
</div>
Expand Down
Loading

0 comments on commit a518536

Please sign in to comment.