-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
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? |
There was a problem hiding this 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 = ''; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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!'; |
There was a problem hiding this comment.
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 ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -38,6 +39,9 @@ class Util { | |||
} else if (score >= RATINGS.AVERAGE.minScore) { | |||
rating = RATINGS.AVERAGE.label; | |||
} | |||
if (score === null) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just felt right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this 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)}`); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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? :)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¡Error!
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏
There was a problem hiding this 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 😆
ready to land when green. |
changes
screenshots