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: metric toggle without JS #8844

Merged
merged 5 commits into from
May 6, 2019
Merged

report: metric toggle without JS #8844

merged 5 commits into from
May 6, 2019

Conversation

paulirish
Copy link
Member

Because importing report-features into PSI is a pain

and because we don't need JS :P

const toggleTmpl = this.dom.cloneTemplate('#tmpl-lh-metrics-toggle', this.templateContext);
const toggleEl = this.dom.find('.lh-metrics-toggle', toggleTmpl);
auditGroupHeader.appendChild(toggleEl);
metricAuditsEl.prepend(...toggleEl.childNodes);
Copy link
Collaborator

Choose a reason for hiding this comment

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

did we lose a little padding by removing this nesting layer? feels a bit close now

image

Copy link
Member Author

Choose a reason for hiding this comment

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

thx.

this.metricDescriptionToggleEl.addEventListener('input', this._toggleMetricDescription);
this.metricAuditGroup.addEventListener('click', e => {
const el = /** @type {HTMLElement} */ (e.target);
if (el.closest('.lh-metric__title')) this.metricDescriptionToggleEl.click();
Copy link
Collaborator

Choose a reason for hiding this comment

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

we lose this click behavior now

IMO, it was a little wonky anyhoo so not the biggest loss but something to consider 🤷‍♂

Copy link
Member Author

Choose a reason for hiding this comment

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

we agreed to remove this thing separately. connor's PR also nukes it
https://github.com/GoogleChrome/lighthouse/pull/8785/files#diff-10f7ab3e3a96491edf29819a09f5b45fL271

@patrickhulce
Copy link
Collaborator

oh and tests need a bit of love :)

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.

I still think if someone is looking for an explanation of what First CPU Idle is they won't think to go click on the pill thing over there, but I guess we'll see how it goes :)


.lh-metric__value {
white-space: nowrap; /* No wrapping between metric value and the icon */
font-weight: 500;
}

.lh-metrics-toggle {
position: relative;
/* No-JS toggle switch
Copy link
Member

Choose a reason for hiding this comment

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

is the indent weird here or just in the review UI?

@@ -163,40 +163,43 @@ describe('ReportUIFeatures', () => {
});
});

// This is done all in CSS, but tested here.
Copy link
Member

Choose a reason for hiding this comment

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

since this is self contained, cut and paste over to performance-category-renderer.js. Slightly better there?

const showClass = 'lh-audit-group--metrics__show-descriptions';
const metricsSelector = '.lh-audit-group--metrics';
const toggleSelector = '.lh-metrics-toggle__input';
const magicSelector = '.lh-metrics-toggle__input:checked ~ .lh-columns .lh-metric__description';
Copy link
Member

Choose a reason for hiding this comment

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

multiplying ~s

Copy link
Member

@exterkamp exterkamp left a comment

Choose a reason for hiding this comment

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

LGTM psi appreciates you 😍

@exterkamp
Copy link
Member

Merged 35 seconds b4 my LGTM!

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