Skip to content

Commit

Permalink
fix(material/chips): change div to span (#26343)
Browse files Browse the repository at this point in the history
For `MatChip` component, change the `<div/>` element for the primary
action to a span element. Fix problem where the div is nested inside a
span. A span is a container for phrasing content and is not supposed to
contain flow content. This could also potentialy cause accessibility
issue. Correct the semantics by nesting a span inside another span.

(cherry picked from commit 14919bd)
  • Loading branch information
zarend authored and crisbeto committed Jan 9, 2023
1 parent 3d7f63b commit 8b19fd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/material/chips/chip.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<span class="mat-mdc-chip-focus-overlay"></span>

<span class="mdc-evolution-chip__cell mdc-evolution-chip__cell--primary">
<div matChipAction [isInteractive]="false">
<span matChipAction [isInteractive]="false">
<span class="mdc-evolution-chip__graphic mat-mdc-chip-graphic" *ngIf="leadingIcon">
<ng-content select="mat-chip-avatar, [matChipAvatar]"></ng-content>
</span>
<span class="mdc-evolution-chip__text-label mat-mdc-chip-action-label">
<ng-content></ng-content>
<span class="mat-mdc-chip-primary-focus-indicator mat-mdc-focus-indicator"></span>
</span>
</div>
</span>
</span>

<span
Expand Down

0 comments on commit 8b19fd9

Please sign in to comment.