Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(theming, toolbar, subheader, input): align color palettes and contrasts with AA standards #11953

Merged
merged 4 commits into from
Jul 2, 2020

Conversation

Splaktar
Copy link
Contributor

@Splaktar Splaktar commented Jul 1, 2020

PR Checklist

Please check that your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added or this is not a bug fix / enhancement
  • Docs have been added, updated, or were not required

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Enhancement
[ ] Documentation content changes
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

  • The contrasts of our color palettes do not meet AA standards (4.5+ ratio).
  • md-toolbars with the md-warn class don't properly theme md-icons
  • There are a number of a11y issues with the demos.
  • md-subheader text does not meet AA standards (4.5+ ratio) due to low opacity.
  • md-input labels and placeholders do not meet AA standards (4.5+ ratio) due to low opacity.

Issue Number:
Fixes #8992. Fixes #10164. Closes #8993

What is the new behavior?

  • align color palettes and contrasts with AA standards
  • properly theme md-icons in toolbars with md-warn
  • all colors and their contrasts meet 4.5 contrast ratio requirements
    • except a few edge cases which have comments to explain them
  • add aria-labels to demoInputsInToolbar
  • increase opacity of subheader text to meet AA contrast ratio requirements
  • increase opacity of input placeholders and labels to meet AA contrast ratio requirements
  • minor regexp adjustments for md-colors
  • fix colors/demoThemePicker and colors/demoBasicUsage to pass Lighthouse a11y audit
  • update button/demoBasicUsage to pass Lighthouse a11y audit
  • add missing alt tag in demoInCardActions and demoCardActionButtons
  • adjust docs app theme to define valid contrast colors for docs-blue
  • fix inaccurate JSDoc

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

I did a lot of extensive testing of this on the docs site using Chrome DevTools contrast checks, Lighthouse A11y Audits, and the WebAIM Contrast Checker.

Previous values used out-of-spec colors for contrast.
Low opacities values caused the design to not to meet AA standards
of minimum 4.5 contrast ratio for default text.

* Set hues with contrast type `light` to `strongLight`.
* Set contrast type for `green` `500` to `dark`.

Fixes #8992. Fixes #10164.
@Splaktar Splaktar added type: bug a11y This issue is related to accessibility ui: theme P2: required Issues that must be fixed. type: spec alignment For issues related to aligning with the Material Design Spec labels Jul 1, 2020
@Splaktar Splaktar added this to the 1.2.0 milestone Jul 1, 2020
@Splaktar Splaktar self-assigned this Jul 1, 2020
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ label Jul 1, 2020
@Splaktar
Copy link
Contributor Author

Splaktar commented Jul 1, 2020

Previous CLA acceptance: #8993 (comment)

@Splaktar Splaktar force-pushed the mdTheme-correctContrastColors branch from be59358 to fe69363 Compare July 1, 2020 05:44
@Splaktar Splaktar requested a review from andrewseguin July 1, 2020 05:47
@Splaktar Splaktar added the pr: merge ready This PR is ready for a caretaker to review label Jul 1, 2020
@Splaktar Splaktar added the pr: lgtm This PR has been approved by the reviewer label Jul 2, 2020
Splaktar added 3 commits July 1, 2020 22:37
…trasts with AA standards

- properly theme `md-icon`s in toolbars with `md-warn`
- all colors and their contrasts meet 4.5 contrast ratio requirements
  - except a few edge cases which have comments to explain them
- add `aria-labels` to demoInputsInToolbar
- increase opacity of subheader text to meet AA contrast ratio requirements
- increase opacity of input placeholders and labels to meet AA contrast ratio requirements
- minor regexp adjustments for `md-colors`
- fix colors/demoThemePicker and colors/demoBasicUsage to pass Lighthouse a11y audit
- update button/demoBasicUsage to pass Lighthouse a11y audit
- add missing alt tag in demoInCardActions and demoCardActionButtons
- adjust docs app theme to define valid contrast colors for `docs-blue`
- fix inaccurate JSDoc

Fixes #8992. Fixes #10164. Closes #8993.

BREAKING CHANGE: The contrast colors (the text or icon color, for example on a raised button) of many of our default palettes have been updated to meet the [AA level of the contrast guidelines](https://www.w3.org/TR/WCAG21/#contrast-minimum) for web accessibility. If you are using our default palettes directly, the accessibility of your application should be improved. However, we recommend that you evaluate this after updating to `1.2.0`. There may be edge cases in your app or custom styles that need to be updated to meet accessibility guidelines.

If you find significant accessibility issues after updating, please report them to us. In `1.2.x`, we have a lot more control over our component theming in regards to hues and opacities.

If your app is using a custom palette, whether based on a copy of default palette or not, we encourage you to evaluate that your contrast configuration meets the WebAIM guidelines. Please review our guide on [Defining Custom Palettes](https://material.angularjs.org/latest/Theming/03_configuring_a_theme#defining-custom-palettes) for details.
…LightColors defined

- if `contrastStrongLightColors` is defined and `contrastLightColors` is not,
  `getContrastType()` was incorrectly picking `dark` instead of `strongLight`
- remove all of the duplicate `contrastLightColors` entries that had to remain before,
  due to this bug
- improve JSDoc
- checkbox's checkmark should always match the background color
  and never depend on the contrast of the accent color
- remove duplicate theme style generation for checkbox and button
…settings

- change docs app's warn theme 500 value to 700 value to make flat warn buttons
  pass contrast checks
- revert docs-red palette defaulting to `A700` since that breaks hover and focus styles
- remove the override of the `.demo-toolbar` color since it is no longer needed
  after the toolbar contrast fixes
@Splaktar Splaktar force-pushed the mdTheme-correctContrastColors branch from fe69363 to fb27d37 Compare July 2, 2020 05:27
@Splaktar Splaktar merged commit 7157b3b into master Jul 2, 2020
@Splaktar Splaktar deleted the mdTheme-correctContrastColors branch July 2, 2020 05:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y This issue is related to accessibility cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ P2: required Issues that must be fixed. pr: lgtm This PR has been approved by the reviewer pr: merge ready This PR is ready for a caretaker to review type: bug type: spec alignment For issues related to aligning with the Material Design Spec ui: theme
Projects
None yet
Development

Successfully merging this pull request may close these issues.

a11y: color palette does not meet AA guidelines theme: palettes using outdated opacity for light contrast
4 participants