-
Notifications
You must be signed in to change notification settings - Fork 28.8k
Increase material button minimum tap target height to 48dp #18048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test?
@@ -290,6 +290,7 @@ class FlatButton extends StatelessWidget { | |||
splashColor: _getSplashColor(theme, buttonTheme), | |||
elevation: 0.0, | |||
highlightElevation: 0.0, | |||
outerPadding: const EdgeInsets.only(top: 6.0, bottom: 6.0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this only be added if the button itself is sized too small or always?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - the spec isn't very clear but only claims a minimum touch target size of 48x48. I updated outer padding to constraints so we can express this
Updating the FlatButton broke some tests for both the snackbar and the time picker. In the time pickers case, the extra space consumed by the buttons shrinks the clock on the time picker. Not sure whether the best approach would be to increase the overall size so that the clock doesn't change shapes or just update all of the tests |
Anything where this changed the layout you probably want to adjust so that the resulting layout is left unchanged. If this changes the layout anywhere, please make sure to follow the breaking change protocol and also make sure to do a google3 roll immediately after landing this to handle any google3 breakage. |
Since this is a major breaking change I will follow up in a week or so |
There are two problematic tests which I need to do more investigation into before submitting |
Something which might make this change easier is to expose the outer padding to each material button class to allow setting it to null, removing the padding. We could default to null for a release so people could have time to fix their code the switch as another breaking change. Similar issues for chips and other tap targets. |
I think we're better off just making the breaking change and moving on, having multiple staged rollouts is confusing and logistically challenging. |
Closing in favor of #18369 |
Increases the minimum tap target height for all material buttons to 48dp using an additional set of outer constraints.
Also adjusts the height of the TimePicker by 12dp and the minimum size of a Snackbar with an action to 48dp.
Fixes #615