Skip to content

Commit 4e58a16

Browse files
committed
fix(material/chips): update chips minimum touch target to 48px
Updates Angular Components' Chips component so that chips use a touch-target span similar to buttons to ensure that chips meet the minimum touch-target size of 48x48 for accessibility standards. Fixes b/537441584
1 parent e93f48e commit 4e58a16

6 files changed

Lines changed: 28 additions & 2 deletions

File tree

src/dev-app/chips/chips-demo.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919

2020
.mat-mdc-basic-chip {
21-
margin: auto 10px;
21+
margin: 8px 10px;
2222
}
2323

2424
mat-chip-grid input {

src/material/chips/chip-option.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<ng-content></ng-content>
2828
<span class="mat-mdc-chip-primary-focus-indicator mat-focus-indicator"></span>
2929
</span>
30+
<span class="mat-mdc-chip-touch-target"></span>
3031
</button>
3132
</span>
3233

src/material/chips/chip-row.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
<span class="mat-mdc-chip-primary-focus-indicator mat-focus-indicator" aria-hidden="true"></span>
3333
</span>
34+
<span class="mat-mdc-chip-touch-target"></span>
3435
</span>
3536

3637
@if (_hasTrailingIcon()) {

src/material/chips/chip-set.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717

1818
.mdc-evolution-chip {
19-
margin: 4px 0 4px 8px;
19+
margin: 8px 0 8px 8px;
2020
}
2121

2222
[dir='rtl'] & {

src/material/chips/chip.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<ng-content></ng-content>
1212
<span class="mat-mdc-chip-primary-focus-indicator mat-focus-indicator"></span>
1313
</span>
14+
<span class="mat-mdc-chip-touch-target"></span>
1415
</span>
1516
</span>
1617

src/material/chips/chip.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ $_graphic-padding: 6px;
1212
$_trailing-action-padding: 8px;
1313
$_avatar-leading-padding: 4px;
1414
$_avatar-trailing-padding: 8px;
15+
$_touch-target-size: 48px;
16+
$_touch-target-vertical-padding: 8px;
1517

1618
$fallbacks: m3-chip.get-tokens();
1719

@@ -27,6 +29,27 @@ $fallbacks: m3-chip.get-tokens();
2729
max-width: 100%;
2830
}
2931

32+
.mat-mdc-standard-chip,
33+
.mat-mdc-basic-chip,
34+
.mat-mdc-evolution-chip {
35+
/* Ensures basic/unstyled chips also have a 32px min-height baseline */
36+
min-height: 32px;
37+
38+
/* 8px top and bottom margin for 48px touch target separation */
39+
margin-top: $_touch-target-vertical-padding;
40+
margin-bottom: $_touch-target-vertical-padding;
41+
}
42+
43+
.mat-mdc-chip-touch-target {
44+
position: absolute;
45+
top: 50%;
46+
left: 0;
47+
right: 0;
48+
height: $_touch-target-size;
49+
transform: translateY(-50%);
50+
pointer-events: auto;
51+
}
52+
3053
.mdc-evolution-chip__cell,
3154
.mdc-evolution-chip__action {
3255
height: 100%;

0 commit comments

Comments
 (0)