Skip to content

Commit

Permalink
fix(material/list): fix duplicate focus with chromevox on action-list…
Browse files Browse the repository at this point in the history
… items (#23361)

For the mat-action-list component, fix chromevox screenreader bug where it
duplicated focus on each item in the action list. After focusing on a
`button` in the action list, linearly navigating forward moved focus to
the `.mat-list-item-content` of the same item.

Fixes this by change the list item content from a `div` to `span`, since
we're generally not supposed to use div's inside buttons.

(cherry picked from commit 8182b35)
  • Loading branch information
zarend authored and mmalerba committed Jan 21, 2022
1 parent 68a29ff commit fa7cd15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/material/list/list-item.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="mat-list-item-content">
<div class="mat-list-item-ripple" mat-ripple
<span class="mat-list-item-content">
<span class="mat-list-item-ripple" mat-ripple
[matRippleTrigger]="_getHostElement()"
[matRippleDisabled]="_isRippleDisabled()">
</div>
</span>

<ng-content select="[mat-list-avatar], [mat-list-icon], [matListAvatar], [matListIcon]">
</ng-content>

<div class="mat-list-text"><ng-content select="[mat-line], [matLine]"></ng-content></div>
<span class="mat-list-text"><ng-content select="[mat-line], [matLine]"></ng-content></span>

<ng-content></ng-content>
</div>
</span>
1 change: 1 addition & 0 deletions src/material/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ $item-inset-divider-offset: 72px;
}

.mat-list-item-ripple {
display: block;
@include layout-common.fill;

// Disable pointer events for the ripple container because the container will overlay the
Expand Down

0 comments on commit fa7cd15

Please sign in to comment.