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: don't display score gauge header if there's only one. #2261
Conversation
for (const category of report.reportCategories) { | ||
scoreHeader.appendChild(this._categoryRenderer.renderScoreGauge(category)); | ||
if (!isSoloCategory) |
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.
I thought we didn't allow no braces multiline if statement
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.
au contraire!
(it was a surprise to me, too)
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.
#2263 :P
|
||
container.appendChild(this._renderReportHeader(report)); // sticky header goes at the top. | ||
container.appendChild(this._renderReportNav(report)); | ||
|
||
const reportSection = container.appendChild(this._dom.createElement('div', 'lh-report')); | ||
|
||
const scoreHeader = reportSection.appendChild( | ||
this._dom.createElement('div', 'lh-scores-header')); | ||
const scoreHeaderClass = `lh-scores-header ${isSoloCategory ? 'lh-scores-header__solo' : ''}`; |
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.
Can we just not have a score header if < 2 categories?
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.
well i was thinking that too, but our styling uses that header's margin to get out from under the pos:fixed header.
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.
ok so the better fix would be to put that margin on something else.
i guess that's the action necessary here.
@brendankenny ptal |
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
@@ -139,18 +139,22 @@ class ReportRenderer { | |||
*/ | |||
_renderReport(report) { | |||
const container = this._dom.createElement('div', 'lh-container'); | |||
const isSoloCategory = report.reportCategories.length === 1; | |||
let scoreHeader; |
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.
move these two lines down to above if (!isSoloCategory) {
?
style nit still applies but other than that, still looks good :P |
Got tired of looking at tops of my perf/a11y reports that look like this:
This PR doesn't show the overview gauges if there's only one.