material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[MaterialTimePicker] Fix the dialog buttons getting clipped at the bottom

Open mck182 opened this issue 2 years ago • 2 comments

The "Cancel" and "Ok" buttons in the dialog are being clipped at the bottom when the theme's minTouchTargetSize is not the default 48dp.

This is because those two buttons are constrained only to the top of the "input mode" button and have no bottom constraint. The "input mode" button is the only one constrained to parent on the bottom edge, which means that if this button gets smaller than those other two buttons - like when the minTouchTargetSize is 0dp - the bottom edge of the dialog will move up, but because those other two buttons are only constrained at the top edge, they stay in place and get clipped.

So this adds a bottom constraint to the "Cancel" and "Ok" buttons, which fixes the clipping issue. I've also changed the end margin from 8dp to 12dp to match the start margin of the "input mode" button, but I'm not too sure about that one, it just seemed nicer to have equal margins on both sides of the dialog.

closes #3584

Here are the screenshots with minTouchTargetSize set to 0dp:

Before After
Screenshot_1695055330 Screenshot_1695055255
Before with layout bounds After with layout bounds
Screenshot_1695051473 Screenshot_1695051555

mck182 avatar Sep 18 '23 16:09 mck182

Ping.

nikclayton avatar Oct 18 '24 10:10 nikclayton

Curious if this fix is onna get reviewed again? It seems that it has been two years and I was actually gonna open a PR myself to fix this as I encountered the issue in an Android app I use, but looks like this could have been included in a release already?

alopix avatar Sep 25 '25 17:09 alopix