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(stepper): bad contrast of step icon in untouched state for M2 #29518

Open
1 task
json-derulo opened this issue Jul 30, 2024 · 2 comments · May be fixed by #29564
Open
1 task

bug(stepper): bad contrast of step icon in untouched state for M2 #29518

json-derulo opened this issue Jul 30, 2024 · 2 comments · May be fixed by #29564
Labels
Accessibility This issue is related to accessibility (a11y) area: material/stepper P4 A relatively minor issue that is not relevant to core functions

Comments

@json-derulo
Copy link
Contributor

json-derulo commented Jul 30, 2024

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 a custom theme, in the stepper it can happen that the step icon (step number or state icon) has a bad contrast:

image

It depends on the contrast color of the primary color. If it's white, everything works correctly, but if it's black, this issue occurs. However for the untouched state, it should always be white, regardless of the contrast color.

Dark mode has the same issue. Here it can even be reproduced in the v16 docs app after selecting the "Purple & Green" theme:

image

I was not able to reproduce this with M3, the predefined themes work fine. I didn't try custom M3 themes though.

Reproduction

StackBlitz link: https://stackblitz.com/edit/61i1fz?file=src%2Fstyles.scss
Steps to reproduce:

  1. Configure a primary color with black as a contrast color in light theme, or white as a contrast color in dark theme
  2. Use the stepper

Expected Behavior

The step icon has sufficient contrast in untouched state

Actual Behavior

The step icon has insufficient contrast in untouched state

Environment

Angular CLI: 18.0.2
Node: 18.20.3
Package Manager: yarn 1.22.19
OS: linux x64

Angular: 18.0.1
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1800.2
@angular-devkit/build-angular 18.0.2
@angular-devkit/core 18.0.2
@angular-devkit/schematics 18.0.2
@angular/cdk 18.1.2
@angular/cli 18.0.2
@angular/material 18.1.2
@angular/material-experimental 18.1.2
@angular/material-moment-adapter 18.1.2
@schematics/angular 18.0.2
rxjs 7.4.0
typescript 5.4.5
zone.js 0.14.6

@json-derulo json-derulo added the needs triage This issue needs to be triaged by the team label Jul 30, 2024
@amysorto amysorto changed the title bug(stepper): bad contrast of step icon in untouched state bug(stepper): bad contrast of step icon in untouched state for M2 Aug 2, 2024
@amysorto amysorto added Accessibility This issue is related to accessibility (a11y) P4 A relatively minor issue that is not relevant to core functions area: material/stepper and removed needs triage This issue needs to be triaged by the team labels Aug 2, 2024
@MadunaThabo
Copy link

Hello

it would seem that the header-icon-foreground-color is applied from the theme passed through

image

image

I would recommend just changing the color of the mat-step-icon in your css

@json-derulo
Copy link
Contributor Author

Actually it's very easy to fix. Add this to your global styles:

.mat-step-icon {
  --mat-stepper-header-icon-foreground-color: #fff; // or #000 for dark theme
}

The --mat-stepper-header-icon-foreground-color variable just contains the wrong value in M2 themes. It should be hard coded white for light theme, and hard coded black for dark theme.

@json-derulo json-derulo linked a pull request Aug 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility This issue is related to accessibility (a11y) area: material/stepper P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants