Skip to content

Increase material button minimum tap target height to 48dp#18048

Closed
jonahwilliams wants to merge 7 commits into
flutter:masterfrom
jonahwilliams:a11y_615
Closed

Increase material button minimum tap target height to 48dp#18048
jonahwilliams wants to merge 7 commits into
flutter:masterfrom
jonahwilliams:a11y_615

Conversation

@jonahwilliams

@jonahwilliams jonahwilliams commented May 30, 2018

Copy link
Copy Markdown
Contributor

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

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

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?

splashColor: _getSplashColor(theme, buttonTheme),
elevation: 0.0,
highlightElevation: 0.0,
outerPadding: const EdgeInsets.only(top: 6.0, bottom: 6.0),

Copy link
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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

Hixie commented Jun 1, 2018

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

@jonahwilliams

Copy link
Copy Markdown
Contributor Author

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

@jonahwilliams

Copy link
Copy Markdown
Contributor 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

Hixie commented Jun 2, 2018

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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