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(mat-divider): Incorrect color token on Material 3 Theme #29494

Closed
1 task done
pmpak opened this issue Jul 26, 2024 · 5 comments
Closed
1 task done

bug(mat-divider): Incorrect color token on Material 3 Theme #29494

pmpak opened this issue Jul 26, 2024 · 5 comments
Labels
needs triage This issue needs to be triaged by the team

Comments

@pmpak
Copy link

pmpak commented Jul 26, 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

18.0.x

Description

In Angular Material 18.1.x, when using a Material 3 theme, the mat-divider component uses the outline token instead of the outline-variant as specified by the Material 3 guidelines. This change caused sections in our application to appear more prominent than expected. Additionally, this creates inconsistency in places where we combine custom styles that set the color of outlines by using the outline-variant role from the theme, and also have mat-dividers within.

I understand that the change from #28995 is to achieve better color contrast. However, this deviates from the specification, which explains that dividers are decorative elements and have no minimum contrast requirements.

https://m3.material.io/components/divider/accessibility
https://m3.material.io/components/divider/specs#f7d1605e-1629-404c-86a5-0ef6848ce520
image

A potential workaround can be to use the --mat-divider-color property and set color to the outline-variant token, but it would be nice if there is no need for style changes.

Reproduction

StackBlitz links:

Steps to reproduce:

  1. Open the example using Angular Material 18.1.x. Observe that the dividers take their color from the outline token.
  2. Open the example using Angular Material 18.0.x. Observe that the dividers take their color from the outline-variant token.

Expected Behavior

Divider uses the outline-variant color token

Actual Behavior

Divider uses the outline color token

Environment

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

Angular: 18.1.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, localize, material, material-experimental
... material-moment-adapter, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1801.2
@angular-devkit/build-angular 18.1.2
@angular-devkit/core 18.1.2
@angular-devkit/schematics 18.1.2
@schematics/angular 18.1.2
rxjs 7.4.0
typescript 5.4.5
zone.js 0.14.6

@pmpak pmpak added the needs triage This issue needs to be triaged by the team label Jul 26, 2024
@crisbeto
Copy link
Member

crisbeto commented Jul 26, 2024

Sounds like it's due to #28995 cc @DBowen33 and @andrewseguin

@behzadmehrabi
Copy link
Contributor

behzadmehrabi commented Aug 14, 2024

Faced the same issue. I think the divider color is just way too dark and doesn't match the spec.

@vulture9
Copy link

vulture9 commented Sep 9, 2024

Yes correct current divider match color 'outline' where according to specs should be outline-variant

@aastrouski
Copy link

Doesn't match the spec:

image

@andrewseguin
Copy link
Contributor

It's true that the divider no longer matches the spec. However this is because the spec is out of date with internal Google guidelines that govern contrast ratios for non-text elements. This change to darken the outline was made to ensure the divider is accessible for all users. The workaround of overriding the divider is recommended if it appears too dark in your application

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

6 participants