Skip to content

Commit 2ba185e

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 a6835ef commit 2ba185e

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
@@ -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,7 @@ $_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, selected-trailing-action-state-layer-color);
552552
}
553553
}
554554

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

692692
// Used as a state overlay.
693693
&::after {
694-
$offset: 2px;
694+
$_touch-target-size: 48px;
695+
$_ripple-size: 24px;
696+
$offset: 3px;
695697
content: '';
696698
display: block;
697699
opacity: 0;
@@ -701,6 +703,11 @@ $_avatar-trailing-padding: 8px;
701703
left: 8px - $offset;
702704
right: 8px - $offset;
703705
border-radius: 50%;
706+
box-sizing: border-box;
707+
padding: calc(($_touch-target-size - $_ripple-size)/2);
708+
margin: calc((($_touch-target-size - $_ripple-size)/2) * -1);
709+
// stylelint-disable material/no-prefixes
710+
background-clip: content-box;
704711
}
705712

706713
.mat-icon {

0 commit comments

Comments
 (0)