WIP: Element screenshots#8797
Conversation
| snippetEl.innerText = item.snippet; | ||
| element.appendChild(snippetEl); | ||
|
|
||
| const fullpageScreenshotUrl = __LIGHTHOUSE_JSON__.audits['full-page-screenshot'].details.data; |
There was a problem hiding this comment.
What's a good way to access this in the renderer?
There was a problem hiding this comment.
I would say it should probably be passed into a DetailsRenderer as the context of the report, almost like setTemplateContext
There was a problem hiding this comment.
Passing it into the DetailsRenderer constructor now.
5480491 to
1b3c178
Compare
There was a problem hiding this comment.
nice @mattzeunert do you think you could update the artifacts so we can play around with it in the now.sh deployment report on the PR? (right now report renderer just throws and page is empty)
| height = Math.min(maxScreenshotHeight, height); | ||
|
|
||
| await driver.sendCommand('Emulation.setDeviceMetricsOverride', { | ||
| // todo: figure out what this means and set appropriately |
There was a problem hiding this comment.
😆 I wonder how many devtools protocol settings we should add this comment to 🤔
| snippetEl.innerText = item.snippet; | ||
| element.appendChild(snippetEl); | ||
|
|
||
| const fullpageScreenshotUrl = __LIGHTHOUSE_JSON__.audits['full-page-screenshot'].details.data; |
There was a problem hiding this comment.
I would say it should probably be passed into a DetailsRenderer as the context of the report, almost like setTemplateContext
| .lh-element-screenshot__content { | ||
| position: absolute; | ||
| right: 0px; | ||
| top: -190px; |
There was a problem hiding this comment.
this is based on the dynamic height we set it js? anyway to fix it or not have the hanging magic value? :)
There was a problem hiding this comment.
It's so that the screenshot doesn't cover the table item you're hovering over and instead appears above it. Not really based on anything though.
Do you think showing the screenshot above the table item on hover is the way to go? And then on mobile we could expand the table item to include the screenshot when the user taps on it.
| if (item.boundingRect) { | ||
| /** @type {Element} */ | ||
| let elementScreenshot; | ||
| element.addEventListener('mouseenter', () => { |
There was a problem hiding this comment.
not sure what our stance is on JS in report now
@paulirish 🤓 🔫 , CSS-only impl? ;)
There was a problem hiding this comment.
I can't find the comment, but I think we decided that's ok on the snippet renderer PR.
Not sure how feasible this would be to do without JS, browsers might not like having a hundred 500kb base64 images on one page.
There was a problem hiding this comment.
Oh that sounds right. I was remembering some I/O convo about going back and forth to make things easier on PSI, but we did already break that barrier.
| const clipId = 'clip-' + Math.floor(Math.random() * 100000000); | ||
| mask.style.width = previewWidth + 'px'; | ||
| mask.style.height = previewHeight + 'px'; | ||
| mask.style.clipPath = 'url(#' + clipId + ')'; |
There was a problem hiding this comment.
clever! I think the chart is scarier than reality given this narrow usecase but still might be troublesome for us? https://caniuse.com/#search=clipPath
would you mind explaining in words what the approach is here? I think I'm getting it but not sure why the mask is necessary
There was a problem hiding this comment.
There isn't anything that can't be done with divs positioned over the image, will change it.
Done now 👍 |
Addressed in this PR.
They have a visible size of 0x0px – do you think we should leave some kind of indication if there's no screenshot?
Maybe if the element is taller than 60px we try to show where on the page it is and zoom out by 2x or 4x, and for smaller ones we do something similar to what we have now?
I changed the CSS so that the hover always appears above the table item. Let's see how the zoomed out stuff from above works and see if it can help with this too. What do you mean by "shift it to the side"?
Will do this:
|
|
hey @mattzeunert we're wanting to land this (mostly for #10517) and willing to invest eng time to get it the rest of the way. mind if we take it from here, or would you be able to pick this back up? I'll go through the PR tomorrow and leave my thoughts. |
|
Hey @connorjclark! Having someone on the team pick it up sounds good 👍 |
|
I forked and started work here: https://github.com/GoogleChrome/lighthouse/compare/elscreens |





Summary
Very WIP 🏗
Todo:
otherwise page content size may change on scroll (e.g. on the BBC homepage)
Known issues:
vh)overflow: scrollcontainers may be hiddenRelated Issues/PRs
fixes #6683
fixes #7327