Skip to content
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

[MaterialDatePicker] Days of month display only first digit when large font scale is used #3642

Open
arekolek opened this issue Oct 18, 2023 · 2 comments

Comments

@arekolek
Copy link

arekolek commented Oct 18, 2023

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

@arekolek arekolek added the bug label Oct 18, 2023
@arekolek
Copy link
Author

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?

@vamjakuldip
Copy link

vamjakuldip commented Dec 19, 2023

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) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants