Skip to content

Commit 37d6220

Browse files
committed
refactor(material/chips): updates touch target centering method
Updates previous Angular Component Chip component fix which added padding to the ::after pseudo-element and attempted to calculate centering. Changes calculation based on using with padding values countered with margin negative values to center the touch target.
1 parent 9eca906 commit 37d6220

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/material/chips/chip.scss

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -695,21 +695,20 @@ $_avatar-trailing-padding: 8px;
695695

696696
// Used as a state overlay.
697697
&::after {
698-
$offset: $_trailing-icon-size; // size of the remove icon
698+
$_touch-target-size: 48px;
699+
$_ripple-size: 24px;
699700
content: '';
700701
display: block;
701702
opacity: 0;
702703
position: absolute;
703-
top: 2 - $offset;
704-
bottom: 2 - $offset;
705-
left: 12 - $offset;
706-
right: 12 - $offset;
707-
border-radius: 50%;
708704
// Increases touch target size to improve accessibility and fix b/286959517
709705
z-index: 100;
710706
pointer-events: all;
711-
height: 48px;
712-
width: 48px;
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+
-webkit-background-clip: content-box;
711+
background-clip: content-box;
713712
}
714713

715714
.mat-icon {

0 commit comments

Comments
 (0)