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: error'd audits get 'Error!' treatment #5077

Merged
merged 8 commits into from
May 3, 2018
Merged

report: error'd audits get 'Error!' treatment #5077

merged 8 commits into from
May 3, 2018

Conversation

paulirish
Copy link
Member

changes

  • what the title said
  • the report's ❌ and ✅ use standard fail/pass colors
  • populateScore no longer sets title/description. Just handles the score gauge.
  • removed right column score/icon for informative/manual audits (no more blue '100's)

screenshots

image

image

@vinamratasingal-zz
Copy link

Hmmm question: why do warnings appear in red? Or is that out of scope for this PR?

Wondering if we should offer similar tooltip visual treatment for warnings + errors?

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

woohoo! so excited about this one 😃 🎉 🍰

return element;
if (audit.result.error) {
element.classList.add(`lh-perf-metric--error`);
descriptionEl.innerHTML = '';
Copy link
Collaborator

Choose a reason for hiding this comment

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

is .textContent = '' not sufficient?

valueEl.textContent = 'Error!';
valueEl.classList.add('tooltip-boundary');
const content = this.dom.createChildOf(valueEl, 'div', 'lh-error-tooltip-content tooltip');
content.textContent = audit.result.debugString || 'Report error: no metric information';
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't this one just for generic audits?

if (audit.result.error) {
auditEl.classList.add(`lh-audit--error`);
const valueEl = this.dom.find('.lh-score__value', auditEl);
valueEl.textContent = 'Error!';
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure I love the ! on the end, save that sucker for the category score ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought felt a little less naked with the bang.

but i'm with the errors being bang-less.

image
image

@@ -38,6 +39,9 @@ class Util {
} else if (score >= RATINGS.AVERAGE.minScore) {
rating = RATINGS.AVERAGE.label;
}
if (score === null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is a noop until the FIXME? if so save for that PR?

@@ -953,13 +949,14 @@ summary.lh-passed-audits-summary {
animation: fadeInTooltip 150ms;
animation-fill-mode: forwards;
animation-delay: 900ms;
min-width: 15em;
min-width: 23em;
Copy link
Collaborator

Choose a reason for hiding this comment

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

just felt right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup. In the new audit-error case the tooltip boundary is super narrow so the tooltip was being displayed at its min-width.

Behold!

image

@paulirish
Copy link
Member Author

Hmmm question: why do warnings appear in red?

Good question.

We do have some warning-ish text right now that we show. We'd prefer to not hide this stuff behind a tooltip.

Here's some of the cases:
image
image
image
image

I'm open to changing their color.

I tried the 'average-color' orange, but the color contrast is too low:
image

Or is that out of scope for this PR?

yah basically. i think we need a design decision. The followup eng work doesn't really retrace steps so we're good.

@vinamratasingal-zz
Copy link

Got it. Not needed for this PR, but I do think that changing the warning color would be good to avoid confusion between warning/error. @hwikyounglee can you help suggest a different color?

Otherwise, LGTM from my side.

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM

re: orange and red. Not an a11y expert, but the difference in hues isn't very significant. If it's not intended to be the primary way of telling them apart, though (since the original intent was just to have them be the same color but let page structure differentiate them) maybe that's fine

@@ -16,21 +16,24 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
const tmpl = this.dom.cloneTemplate('#tmpl-lh-perf-metric', this.templateContext);
const element = this.dom.find('.lh-perf-metric', tmpl);
element.id = audit.result.name;
// FIXME(paulirish): currently this sets a 'lh-perf-metric--undefined' class on error'd audits
element.classList.add(`lh-perf-metric--${Util.calculateRating(audit.result.score)}`);
Copy link
Member

Choose a reason for hiding this comment

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

just add a conditional on const rating = Util.calculateRating(audit.result.score); if (rating !== undefined) {element.classList.add(...);}? Since lh-perf-metric--error is added below that seems like it's fine (unless you have more specific future plans)

Copy link
Member Author

@paulirish paulirish May 3, 2018

Choose a reason for hiding this comment

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

sorry. the undefined was from back when i was fixing score === null, too. mixing up my branches. sry.

Right now scores are 0 in the case of error's. :(
I split that into a second PR because it opens a big can of worms.

if (audit.result.error) {
element.classList.add(`lh-perf-metric--error`);
descriptionEl.textContent = '';
valueEl.textContent = 'Error';
Copy link
Member

Choose a reason for hiding this comment

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

ha, well I actually liked the bangful message. Agree that Error just sitting on its own looks incomplete or like the string accidentally leaked into the html there rather than intentionally placed :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

if it were small caps'd and had a hover state ala material design would you feel differently? :)

Copy link
Member

Choose a reason for hiding this comment

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

ha, I think it's making it feel deliberate rather than any particular way of doing that :) Right now it kind of looks like we had a error string of 'Error\nsomething something' and the rest of the string was cut off by the template or overflow hidden or something

Copy link
Member

Choose a reason for hiding this comment

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

¡Error!

Copy link
Collaborator

Choose a reason for hiding this comment

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

¡Error!

this 💯

const valueEl = this.dom.find('.lh-score__value', auditEl);
valueEl.textContent = 'Error';
valueEl.classList.add('tooltip-boundary');
const content = this.dom.createChildOf(valueEl, 'div', 'lh-error-tooltip-content tooltip');
Copy link
Member

Choose a reason for hiding this comment

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

bikeshed: if it's a tooltip, name the variable tooltip?

element.classList.add(`lh-perf-metric--error`);
descriptionEl.textContent = '';
valueEl.textContent = 'Error';
const content = this.dom.createChildOf(descriptionEl, 'span', 'lh-error-tooltip-content');
Copy link
Member

Choose a reason for hiding this comment

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

tooltip?

const scoreOutOf100 = Math.round(score * 100);
const valueEl = this.dom.find('.lh-score__value', element);
valueEl.textContent = Util.formatNumber(scoreOutOf100);
valueEl.classList.add(`lh-score__value--${Util.calculateRating(score)}`,
`lh-score__value--${scoreDisplayMode}`);

this.dom.find('.lh-audit__title, .lh-category-header__title', element).appendChild(
Copy link
Member

Choose a reason for hiding this comment

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

👏 👏

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM!

if you're both on the bang train I can live with Error!, I'll just take it as incentive to eliminate as many of our errors as possible 😆

@paulirish
Copy link
Member Author

ready to land when green.

@paulirish paulirish merged commit 734e09b into master May 3, 2018
@paulirish paulirish deleted the auditerror branch May 3, 2018 18:42
@paulirish paulirish mentioned this pull request May 4, 2018
82 tasks
kdzwinel pushed a commit to kdzwinel/lighthouse that referenced this pull request Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants