Skip to content

Commit bbea4b9

Browse files
committed
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
1 parent 13aef8c commit bbea4b9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/material/chips/chip.scss

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ $_avatar-trailing-padding: 8px;
538538
}
539539

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

544544
&:hover::after {
@@ -552,7 +552,7 @@ $_avatar-trailing-padding: 8px;
552552

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

@@ -695,7 +695,9 @@ $_avatar-trailing-padding: 8px;
695695

696696
// Used as a state overlay.
697697
&::after {
698-
$offset: 2px;
698+
$_touch-target-size: 48px;
699+
$_ripple-size: 24px;
700+
$offset: 3px;
699701
content: '';
700702
display: block;
701703
opacity: 0;
@@ -705,6 +707,11 @@ $_avatar-trailing-padding: 8px;
705707
left: 8px - $offset;
706708
right: 8px - $offset;
707709
border-radius: 50%;
710+
box-sizing: border-box;
711+
padding: calc(($_touch-target-size - $_ripple-size)/2);
712+
margin: calc((($_touch-target-size - $_ripple-size)/2) * -1);
713+
// stylelint-disable material/no-prefixes
714+
background-clip: content-box;
708715
}
709716

710717
.mat-icon {

0 commit comments

Comments
 (0)