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

report: improve color contrast of top-level errors #10636

Merged
merged 6 commits into from
May 12, 2020

Conversation

baseeee
Copy link
Contributor

@baseeee baseeee commented Apr 25, 2020

Summary

Added higher contrast colors and made slight layout adjustments to the runtime error warning box on the report webpage.

Related Issues/PRs

#9559

@baseeee baseeee requested a review from a team as a code owner April 25, 2020 17:47
@baseeee baseeee requested review from connorjclark and removed request for a team April 25, 2020 17:47
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@baseeee
Copy link
Contributor Author

baseeee commented Apr 25, 2020

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

Copy link
Collaborator

@connorjclark connorjclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for capturing the details in the issue! there's a small contrast issue, but most of my comments have to due with maintaining the consistency in this file.

@@ -66,7 +67,7 @@
--color-informative: var(--color-blue-900);
--color-pass-secondary: var(--color-green-700);
--color-pass: var(--color-green);
--color-hover: var(--color-gray-50);
--color-hover: var(--color-gray-50);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you alphabetize this? you can just select all the lines and "sort" in your IDE–we keep everything here sorted.

also I think there is some whitespace at the end of this line (and a couple others)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected these

@@ -1010,16 +1011,21 @@

.lh-warnings--toplevel {
--item-margin: calc(var(--header-line-height) / 4);
color: var(--report-text-color-secondary);
color: var(--report-text-color);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make a --toplevel-warning-text-color variable, initialized to var(--report-text-color), and vary it to var(--color-orange-700) in dark mode? Trying to solve these things:

  1. color contrast in light mode for this text fails the axe audit. Let's ignore the color given in the design for that and just use black.
  2. we try not to use colors directly in the css, but instead alias to a component variable. see the "naming" comment at the top of the file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have misunderstood this so apologies if this needs corrected.

I believe it was the text "There were issues affecting this run of Lighthouse:" that was causing the contrast issue, the text color for this is controlled by the .lh-warnings__msg class so I have created another component variable for this text color along with the --toplevel-warning-text-color requested.

I think I've followed the correct conventions for this but I'm unsure if the result is exactly what you were looking for.

image

image

max-width: calc(var(--report-width) - var(--category-padding) * 2);
background-color: var(--color-amber-50);
max-width: calc(var(--report-width) - var(--category-padding) * 2);
background-color: rgba(var(--color-orange-rgb), .1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

introduce a new variable --toplevel-warning-background-color

Instead of using alpha, I think we want it set to orange 100 (#FFCCBC) in light mode and #544B40 for dark mode (I don't see a clean fit from the material ui colors, oh well)

initial value: var(--color-orange-100)
dark mode: #544B40 (unless you can find a good material ui color)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected this, although I set the light mode background color to orange-50 instead of orange-100 as I felt this was a closer match to the original color

@connorjclark
Copy link
Collaborator

@baseeee thanks for your contributions so far! I think this is important for our 6.0 release in ~3 weeks. Are you able to incorporate the feedback by then? If not, I'm happy to take over.

@baseeee
Copy link
Contributor Author

baseeee commented May 5, 2020

@connorjclark Hello, sorry for my periods of inactivity, life's been pretty manic recently but I still really want to help out. I can sort out the issues this weekend if that suits your timescale.

Thank you for the comprehensive notes and feedback too, it's a massive help.

@connorjclark
Copy link
Collaborator

@connorjclark Hello, sorry for my periods of inactivity, life's been pretty manic recently but I still really want to help out. I can sort out the issues this weekend if that suits your timescale.

Thank you for the comprehensive notes and feedback too, it's a massive help.

No worries! There's still plenty of time :)

@GoogleChrome GoogleChrome deleted a comment May 5, 2020
@paulirish
Copy link
Member

paulirish commented May 7, 2020

No worries! There's still plenty of time :)

A quick note. We're cutting our release next week, actually. We'll very happily finish off this PR monday if you don't get around to it, @baseeee. No big deal either way. :D

@baseeee
Copy link
Contributor Author

baseeee commented May 9, 2020

@connorjclark I've finished making these changes, sorry if you still need to tweek anything before the release. Thanks for letting me help out :)

Copy link
Collaborator

@connorjclark connorjclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for sticking to it! css and vars look good. only thing left are trivial:

  • using spaces instead of tabs (sry! I wish we had a linter for this)
  • asking @hwikyounglee if we meant to drop the bold text

lighthouse-core/report/html/report-styles.css Outdated Show resolved Hide resolved
lighthouse-core/report/html/report-styles.css Show resolved Hide resolved
lighthouse-core/report/html/report-styles.css Outdated Show resolved Hide resolved
@@ -18,7 +18,7 @@
<!-- Lighthouse run warnings -->
<template id="tmpl-lh-warnings--toplevel">
<div class="lh-warnings lh-warnings--toplevel">
<strong class="lh-warnings__msg"></strong>
<p class="lh-warnings__msg"></p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hwikyounglee just wanna double check we want to make this be not bold.

this:
image
image

or that:
image
image

Copy link

@hwikyounglee hwikyounglee May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the design

  • No bold
  • On the light mode: the title 'There were...' should be in orange #d04900

Could we try the color for the light mode?
I think the colors would do it without bold weight.

Side note: the orange in dark mode is #ffa400

https://yuinchien.com/sandbox/lighthouse/ (click on the (i) at the top right, and also 'd' for light/dark toggle)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the color contrast for those light colors #d04900 (text) and rgb(255, 246, 234) (background) has too low contrast according to axe :(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we're in a place to add or replace the color with #BD4200

It's 4.97
https://contrast-ratio.com/#%23BD4200-on-%20rgb%28255%2C%20246%2C%20234%29

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

seems good to me.

@connorjclark
Copy link
Collaborator

thanks @baseeee and @hwikyounglee ! lookin good https://lighthouse-fxbzonyd8.now.sh/error/

@connorjclark connorjclark changed the title report(webpage): update the style of runtime error message report: improve color contrast of top-level errors May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants