Skip to content

Commit

Permalink
fix(material/chips): increase chip remove touch target size (#29452)
Browse files Browse the repository at this point in the history
* fix(material/chips): increase chip remove touch target size

Fixes Angular Components Chips component accessibility issue
where the touch target is too small. Updates the chips' remove
button ::after margin and padding styles to create a larger
touch target to meet the minimum 48px x 48px size.

Fixes b/286959517

* refactor(material/chips): fix lint errors

Updates previous fix to correct lint error due to changing some
lines from background to targeting background-color specifically.

(cherry picked from commit 777d1d2)
  • Loading branch information
essjay05 authored and andrewseguin committed Sep 18, 2024
1 parent 7ab65e4 commit f9e1810
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/material/chips/chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ $_avatar-trailing-padding: 8px;
}

&::after {
@include token-utils.create-token-slot(background, trailing-action-state-layer-color);
@include token-utils.create-token-slot(background-color, trailing-action-state-layer-color);
}

&:hover::after {
Expand All @@ -548,7 +548,8 @@ $_avatar-trailing-padding: 8px;

.mat-mdc-chip-selected .mat-mdc-chip-remove::after,
.mat-mdc-chip-highlighted .mat-mdc-chip-remove::after {
@include token-utils.create-token-slot(background, selected-trailing-action-state-layer-color);
@include token-utils.create-token-slot(background-color,
selected-trailing-action-state-layer-color);
}
}

Expand Down Expand Up @@ -691,7 +692,9 @@ $_avatar-trailing-padding: 8px;

// Used as a state overlay.
&::after {
$offset: 2px;
$_touch-target-size: 48px;
$_ripple-size: 24px;
$offset: 3px;
content: '';
display: block;
opacity: 0;
Expand All @@ -701,6 +704,11 @@ $_avatar-trailing-padding: 8px;
left: 8px - $offset;
right: 8px - $offset;
border-radius: 50%;
box-sizing: border-box;
padding: calc(($_touch-target-size - $_ripple-size)/2);
margin: calc((($_touch-target-size - $_ripple-size)/2) * -1);
// stylelint-disable material/no-prefixes
background-clip: content-box;
}

.mat-icon {
Expand Down

0 comments on commit f9e1810

Please sign in to comment.