Skip to content

Commit f9e1810

Browse files
essjay05andrewseguin
authored andcommitted
fix(material/chips): increase chip remove touch target size (#29452)
* 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)
1 parent 7ab65e4 commit f9e1810

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/material/chips/chip.scss

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ $_avatar-trailing-padding: 8px;
534534
}
535535

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

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

549549
.mat-mdc-chip-selected .mat-mdc-chip-remove::after,
550550
.mat-mdc-chip-highlighted .mat-mdc-chip-remove::after {
551-
@include token-utils.create-token-slot(background, selected-trailing-action-state-layer-color);
551+
@include token-utils.create-token-slot(background-color,
552+
selected-trailing-action-state-layer-color);
552553
}
553554
}
554555

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

692693
// Used as a state overlay.
693694
&::after {
694-
$offset: 2px;
695+
$_touch-target-size: 48px;
696+
$_ripple-size: 24px;
697+
$offset: 3px;
695698
content: '';
696699
display: block;
697700
opacity: 0;
@@ -701,6 +704,11 @@ $_avatar-trailing-padding: 8px;
701704
left: 8px - $offset;
702705
right: 8px - $offset;
703706
border-radius: 50%;
707+
box-sizing: border-box;
708+
padding: calc(($_touch-target-size - $_ripple-size)/2);
709+
margin: calc((($_touch-target-size - $_ripple-size)/2) * -1);
710+
// stylelint-disable material/no-prefixes
711+
background-clip: content-box;
704712
}
705713

706714
.mat-icon {

0 commit comments

Comments
 (0)