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

Style issues with PWA header gauge #9139

Closed
connorjclark opened this issue Jun 6, 2019 · 6 comments · Fixed by #9151
Closed

Style issues with PWA header gauge #9139

connorjclark opened this issue Jun 6, 2019 · 6 comments · Fixed by #9151

Comments

@connorjclark
Copy link
Collaborator

image

@brendankenny
Copy link
Member

bisected to #9023

@connorjclark
Copy link
Collaborator Author

connorjclark commented Jun 7, 2019

https://googlechrome.github.io/lighthouse/viewer/?gist=631af25962bb4848fbc21115ad173bad hmmm maybe the viewer code is too old? try this: Forgot to deploy 5.1 to the viewer. Fixed :)

Run this:

document.querySelector('.lh-report').prepend(document.querySelector('.lh-scores-header .lh-gauge--pwa__wrapper'));

You'll see that the check mark appears only after the sticky header is present.

@connorjclark
Copy link
Collaborator Author

connorjclark commented Jun 7, 2019

It is strange that turning off display: none for .lh-sticky-header prevents the issue. I'll file a browser bug.

https://bugs.chromium.org/p/chromium/issues/detail?id=971907

@patrickhulce
Copy link
Collaborator

This feels oddly reminiscent of the scrolling PWA SVG Chrome bug...

@connorjclark
Copy link
Collaborator Author

connorjclark commented Jun 7, 2019

Hard to believe we're finding so many bugs with SVGs (well, 2, but that seems a lot for browser bugs). Are we doing something that unique? Or do most people not know they can report issues like this to Chromium?

@brendankenny
Copy link
Member

brendankenny commented Jun 7, 2019

Turns out this is not a chrome bug (the same thing happens in Firefox, though not in Safari).

The PWA score gauge is using references for its badges and gradients (so it can do things like <path fill="url(#lh-gauge--pwa__check-circle__gradient) d="..."></path> to share a circle gradient between versions of the gauge). These are defined in a <defs> element inside the gauge's svg element.

The problem is that these use ids for the reference, and ids are supposed to be unique...but we include three copies of the gauge in the page (scores header, sticky header, and category). When trying to render the gradient (or badge), the renderer looks up the referenced element by picking the first one it finds in the DOM, which (after #9023) happens to be display: none in the sticky header, so nothing is rendered for the referenced element.

There are a few ways of fixing this, but basically it comes down to one of

  • don't use references
  • dedupe the <defs>
  • have unique IDs for all instances of the gauge

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 a pull request may close this issue.

3 participants