This repository was archived by the owner on Jan 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,25 @@ Disabled buttons cannot be interacted with and have no visual interaction effect
137
137
</button >
138
138
```
139
139
140
+ ## Additional Information
141
+
142
+ ### Accessibility
143
+
144
+ Material Design spec advises that touch targets should be at least 48 x 48 px.
145
+ To meet this requirement, add the following to your button:
146
+
147
+ ``` html
148
+ <span >
149
+ <button class =" mdc-button mdc-button--touch" >
150
+ <div class =" mdc-button__ripple" ></div >
151
+ <span class =" mdc-button__label" >My Accessible Button</span >
152
+ <div class =" mdc-button__touch" ></div >
153
+ </button >
154
+ </span >
155
+ ```
156
+
157
+ Note that the wrapper ` <span> ` element is only necessary if you want to avoid potentially overlapping touch targets on adjacent elements (due to collapsing margins).
158
+
140
159
## Style Customization
141
160
142
161
### CSS Classes
Original file line number Diff line number Diff line change 27
27
@import " @material/rtl/mixins" ;
28
28
@import " @material/theme/functions" ;
29
29
@import " @material/theme/mixins" ;
30
+ @import " @material/touch-target/mixins" ;
30
31
@import " @material/typography/mixins" ;
31
32
@import " @material/shape/mixins" ;
32
33
@import " @material/shape/functions" ;
@@ -61,6 +62,10 @@ $mdc-button-ripple-target: ".mdc-button__ripple";
61
62
}
62
63
}
63
64
65
+ .mdc-button__touch {
66
+ @include mdc-touch-target ($query );
67
+ }
68
+
64
69
@include mdc-button-ink-color (primary, $query );
65
70
}
66
71
@@ -116,6 +121,11 @@ $mdc-button-ripple-target: ".mdc-button__ripple";
116
121
@include mdc-button--dense_ ;
117
122
}
118
123
}
124
+
125
+ .mdc-button--touch {
126
+ @include mdc-touch-target-component (
127
+ $component-height : $mdc-button-height , $query : $query );
128
+ }
119
129
// postcss-bem-linter: end
120
130
}
121
131
Original file line number Diff line number Diff line change 24
24
@import " @material/feature-targeting/mixins" ;
25
25
@import " ./variables" ;
26
26
27
- /* * Styles applied to the component's inner touch target element. */
27
+ // Styles applied to the component's inner touch target element.
28
28
@mixin mdc-touch-target ($query : mdc-feature-all ()) {
29
29
$feat-structure : mdc-feature-create-target ($query , structure );
30
30
38
38
}
39
39
}
40
40
41
- /* * Styles applied to the component with the increased touch target. */
41
+ // Styles applied to the component with the increased touch target.
42
42
@mixin mdc-touch-target-component ($component-height , $query : mdc-feature-all ()) {
43
43
$feat-structure : mdc-feature-create-target ($query , structure );
44
44
You can’t perform that action at this time.
0 commit comments