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(Button): Ripple color is not automatically calculated #30049

Open
1 task
danielalexis opened this issue Nov 20, 2024 · 4 comments
Open
1 task

bug(Button): Ripple color is not automatically calculated #30049

danielalexis opened this issue Nov 20, 2024 · 4 comments
Labels
needs triage This issue needs to be triaged by the team

Comments

@danielalexis
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

When using mat.button-overrides() when changing the filled-ripple-color property the ripple becames the full color instead of having an opacity of 12%

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-heyt9c
Steps to reproduce:

  1. Press on button
  2. Wrong opacity is displayed

in the SCSS file theres the right way to do it

Expected Behavior

Ripple have a subtle color, opacity 12%
Expected Color: Image

Actual Behavior

Ripple has full color
Actual behavior: Image

Environment

  • Angular: 19.0.0
  • CDK/Material: 19.0.0
  • Browser(s): Firefox 132
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@danielalexis danielalexis added the needs triage This issue needs to be triaged by the team label Nov 20, 2024
@msrumon
Copy link

msrumon commented Nov 20, 2024

This overrides mixins are killin' me TBH. The Angular Material team needs to work on this. Make the process simpler, give us a way to provide primary / secondary / tertiary / error values for mat.theme users. 🙏

@danielalexis
Copy link
Author

You can generate a theme using ng generate @angular/material:theme-color this gives you a primary and tertiary palettes which you can use on mat.theme

@msrumon
Copy link

msrumon commented Nov 21, 2024

No, that's not what I'm talking about. Before mat.theme, we used to have mat.define-theme (which still is supported BTW) where we would create separate themes for light and dark modes. Then we could easily generate alternate-colored components using mat.<component>-theme mixins. For example,

[m3-tertiary-button] {
  @include mat.button-color(
    $light-theme,
    $color-variant: tertiary
  );

  @media (prefers-color-scheme: dark) {
    @include mat.button-color(
      $dark-theme,
      $color-variant: tertiary
    );
  }
}

We needed to be able to do the same for mat.theme as well, since we don't "define" any additional "theme"s in this case and light-dark does most of those works for us automagically. Something like:

@mixin theme-overrides($variant: primary) {
  // ...
}

Here, default is "primary" palette, but we can generate themes for other palettes ("secondary"/"tertiary"/"error") as well.

@msrumon
Copy link

msrumon commented Nov 21, 2024

A more extensive demo: https://stackblitz.com/edit/stackblitz-starters-allvh4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

2 participants