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

bug(datepicker): Value of calendar text size CSS variable is overriden by the user agent stylesheet #29608

Closed
1 task
zilia-gmethot opened this issue Aug 19, 2024 · 2 comments · Fixed by #29610
Closed
1 task
Assignees
Labels
area: material/datepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@zilia-gmethot
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

The --mat-datepicker-calendar-text-size CSS variable of Angular Material's datepicker isn't applied properly because the font size of children element is overriden by the browser user agent style for the button element.

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-dmhaw2?file=src%2Fglobal-styles.scss

Steps to reproduce:

  1. In global-styles.scss, change the value of the --mat-datepicker-calendar-text-size and note that it doesn't affect the size of the day values of the datepicker.

Expected Behavior

I should be able to configure the font-size of the day values of the datepicker by setting a different value to the --mat-datepicker-calendar-text-size CSS variable.

Actual Behavior

When configuring the font-size of the day values of the datepicker by setting a different value to the --mat-datepicker-calendar-text-size CSS variable, no change occurs.

Environment

  • Angular: 18.2.0
  • CDK/Material: 18.2.0
  • Browser(s): Google Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 11
@zilia-gmethot zilia-gmethot added the needs triage This issue needs to be triaged by the team label Aug 19, 2024
@crisbeto crisbeto self-assigned this Aug 20, 2024
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/datepicker and removed needs triage This issue needs to be triaged by the team labels Aug 20, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 20, 2024
We were setting the `calendar-text-font` and `calendar-text-size` tokens at the top level of the calendar which meant that it wasn't being picked up in the cells, because they have `button` elements which have user agent styles.

These changes resolve the issue by explicitly setting the tokens.

Also fixes that the font size was too big in M3.

Fixes angular#29608.
@zilia-gmethot
Copy link
Author

@crisbeto Thank you so much!

crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 20, 2024
We were setting the `calendar-text-font` and `calendar-text-size` tokens at the top level of the calendar which meant that it wasn't being picked up in the cells, because they have `button` elements which have user agent styles.

These changes resolve the issue by explicitly setting the tokens.

Also fixes that the font size was too big in M3.

Fixes angular#29608.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 20, 2024
We were setting the `calendar-text-font` and `calendar-text-size` tokens at the top level of the calendar which meant that it wasn't being picked up in the cells, because they have `button` elements which have user agent styles.

These changes resolve the issue by explicitly setting the tokens.

Also fixes that the font size was too big in M3.

Fixes angular#29608.
crisbeto added a commit that referenced this issue Aug 20, 2024
…29610)

We were setting the `calendar-text-font` and `calendar-text-size` tokens at the top level of the calendar which meant that it wasn't being picked up in the cells, because they have `button` elements which have user agent styles.

These changes resolve the issue by explicitly setting the tokens.

Also fixes that the font size was too big in M3.

Fixes #29608.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 20, 2024
…ngular#29610)

We were setting the `calendar-text-font` and `calendar-text-size` tokens at the top level of the calendar which meant that it wasn't being picked up in the cells, because they have `button` elements which have user agent styles.

These changes resolve the issue by explicitly setting the tokens.

Also fixes that the font size was too big in M3.

Fixes angular#29608.
crisbeto added a commit that referenced this issue Aug 21, 2024
…29610) (#29615)

We were setting the `calendar-text-font` and `calendar-text-size` tokens at the top level of the calendar which meant that it wasn't being picked up in the cells, because they have `button` elements which have user agent styles.

These changes resolve the issue by explicitly setting the tokens.

Also fixes that the font size was too big in M3.

Fixes #29608.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/datepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants