Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed
wants to merge 7 commits into from

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented May 30, 2018

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

Copy link
Member

@goderbauer goderbauer left a 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),
Copy link
Member

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?

Copy link
Member Author

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

@jonahwilliams
Copy link
Member Author

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

@Hixie
Copy link
Contributor

Hixie commented Jun 1, 2018

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.

@jonahwilliams jonahwilliams changed the title Increase flat button tap target using outer padding Increase material button minimum tap target height to 48dp Jun 1, 2018
@jonahwilliams
Copy link
Member Author

Since this is a major breaking change I will follow up in a week or so

@jonahwilliams
Copy link
Member Author

There are two problematic tests which I need to do more investigation into before submitting

@jonahwilliams
Copy link
Member Author

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.

@Hixie
Copy link
Contributor

Hixie commented Jun 2, 2018

I think we're better off just making the breaking change and moving on, having multiple staged rollouts is confusing and logistically challenging.

@jonahwilliams
Copy link
Member Author

Closing in favor of #18369

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flat buttons are supposed to have a 48px high tap target
4 participants