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

devtools: enable sticky header, top bar, and report ui features #9023

Merged
merged 42 commits into from
May 30, 2019

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented May 22, 2019

LH changes for #9019.

image

@connorjclark
Copy link
Collaborator Author

We're bringing report ui features (mostly) to DevTools. Plus, the sticky heady and the topbar.

image

@connorjclark
Copy link
Collaborator Author

Small issue: when you resize the docked DevTools, the highlighter becomes off:

image

Normally, resizing is handled easily w/ a resize event handler. But how can listen to the DevTools dock resizing?

@connorjclark
Copy link
Collaborator Author

fireworks:

image

@connorjclark connorjclark changed the title report(redesign): update styles for devtools devtools: enable sticky header, top bar, and report ui features May 25, 2019
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.

exciting times ahead for devtools :D


if (this._dom.isDevTools()) {
// Not ready for DevTools.
// Saving as HTML save the entire AuditsPanel.
Copy link
Collaborator

Choose a reason for hiding this comment

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

hm it's not super clear what's being enabled in DT and what's not since the comments sorta line up with what's in the else.

not sure how to fix this maybe it's just moving to have a comment for each line explaining why it can't be enabled and/or when it might be moved out of the else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure - ...does not work. is not a good comment :)

lighthouse-core/report/html/renderer/report-ui-features.js Outdated Show resolved Hide resolved
@@ -260,6 +261,10 @@
--audit-group-indent: 16px;
--audit-indent: 16px;
--expandable-indent: 16px;
--gauge-circle-size-big: 96px;
--gauge-circle-size: 72px;
/* Consider offset of the DevTools UI. */
Copy link
Collaborator

Choose a reason for hiding this comment

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

these feels slightly magical is there anyway we can link to how to compute this number in the future? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So I actually just increased the offset value until the topbar was 100% visible and there was no gap between the DevTools UI + the topbar.

Think I should look into computing the offset at runtime, and somehow injecting the CSS variable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh haha, nah maybe just make a note of "this is the height of the devtools UI as eyeballed by a developer in styles panel" or something? 😆

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 (scoreHeader && !this._dom.isDevTools()) {
if (scoreHeader) {
Copy link
Member

Choose a reason for hiding this comment

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

can we combine these if (scoreHeader) blocks now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

// We can't rely on listening to the window resize event for DevTools, so we first
// attempt the new ResizeObserver web platform feature. It has poor cross browser
// support, so we should check that it's supported. However, there are some performance
// issues with using window.ResizeObserver - it updates much more often than the 'resize'
Copy link
Collaborator Author

@connorjclark connorjclark May 30, 2019

Choose a reason for hiding this comment

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

When using the ResizeObserver in the deploy report (It's disabled outside devtools but if you revert that bit), and add some logging to the callback:

// Show sticky header when the score scale begins to go underneath the topbar.
const topbarBottom = this.topbarEl.getBoundingClientRect().bottom;
const scoreScaleTop = this.scoreScaleEl.getBoundingClientRect().top;
const showStickyHeader = topbarBottom >= scoreScaleTop;
// add this line
console.log(topbarBottom, scoreScaleTop, showStickyHeader);

image

You see that the position of our topbar is jumping all over the place!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So we should just disable it outside DevTools for now, luckily it works there perfectly.

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.

last things, otherwise LGTM

}

/* Disable the gauge arc animation for the sticky header, so toggling display: none
does not play the animation. */
Copy link
Member

Choose a reason for hiding this comment

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

evidence number 25 that these different uses of the score gauges should share less than they do :)

lighthouse-core/report/html/renderer/report-renderer.js Outdated Show resolved Hide resolved
// support, so we should check that it's supported. However, there are some performance
// issues with using window.ResizeObserver - it updates much more often than the 'resize'
// event fires, and the experience is choppy in LH. For now, limit use to just DevTools,
// which doesn't seem affected for some reason.
Copy link
Member

Choose a reason for hiding this comment

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

since in theory ResizeObserver is more efficient and the future path to monitoring resizes, what about
// Use ResizeObserver where available. TODO: there is an issue with incorrect position numbers and, as a result, performance issues due to layout thrashing. See https://github.com/GoogleChrome/lighthouse/pull/9023/files#r288822287 for details.

Copy link
Collaborator Author

@connorjclark connorjclark May 30, 2019

Choose a reason for hiding this comment

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

are you also suggesting removing the devtools check?

Copy link
Member

Choose a reason for hiding this comment

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

are you also suggesting removing the devtools check?

whoops, no, good point. I like your version

lighthouse-core/report/html/renderer/report-ui-features.js Outdated Show resolved Hide resolved
@brendankenny
Copy link
Member

there's a type check error...the type definition isn't working? It should be declared on window...

@connorjclark
Copy link
Collaborator Author

tsconfig for viewer was wrong. Compiler option typeRoots don't resolve to the nearest node_modules as one would expect.

@connorjclark
Copy link
Collaborator Author

friggen flakes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants