material-components-android
material-components-android copied to clipboard
[MaterialDatePicker] Days of month display only first digit when large font scale is used
Description:
Using a default new project in Android Studio that uses Theme.Material3.DayNight.NoActionBarwhen you show a MaterialDatePicker and set full screen zoom (320dp width) and 200% font size in system setting, the dialog does not pass WCAG guildelines and Google's own guidelines https://support.google.com/accessibility/android/answer/12159181 "parts of the text to become cropped, cut, or obscured".
You can see on the screenshot that days of week are cut, and days of month are cropped - only the first digit is visible, making the date picker unusable.
Expected behavior:
Follow recommendation from linked guidelines:
Avoid text content with a fixed height and width. Prefer responsive layouts that can readily accommodate different screen sizes, screen orientations, pixel densities, and font sizes.
For example DatePickerDialog from Android SDK handles this correctly:
Source code:
MaterialDatePicker.Builder
.datePicker()
.build()
.show(supportFragmentManager, null)
Minimal sample app repro: DateTimePicker.zip
Android API version: API 34
Material Library version: 1.10.0
I'm using the latest version of the com.google.android.material:material library.
Device: Pixel 7 Pro emulator
Theme.MaterialComponents.DayNight.NoActionBar suffers the same issue when it comes to days of week:
At least it doesn't have the problem with days of month.
Should I report a separate issue for M2, or can this issue be used to track both?
When your app is overriding this base context to set defaults, MaterialDatePicker is not even showing.
Material Library version: 1.10.0, 1.11.0.
override fun attachBaseContext(newBase: Context) { newBase.resources?.configuration?.setToDefaults() super.attachBaseContext(newBase) }