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

DBW: suggestion will-change usage #742

Open
ebidel opened this issue Oct 4, 2016 · 4 comments
Open

DBW: suggestion will-change usage #742

ebidel opened this issue Oct 4, 2016 · 4 comments
Labels
needs-complete-audit-proposal https://github.com/GoogleChrome/lighthouse/blob/master/docs/new-audits.md new_audit P3

Comments

@ebidel
Copy link
Contributor

ebidel commented Oct 4, 2016

Best I've come up with:

  • Suggest if a transition property is used but no will-change property is found in the same selector.
  • will-change instead of translateZ(0) usage

Should also be clear in the helpText that developers should not will-change all the things!

https://developer.mozilla.org/en-US/docs/Web/CSS/will-change

@wardpeet
Copy link
Collaborator

wardpeet commented Oct 5, 2016

what about if you do both? Because for older browsers you will need the fallback?

@paulirish
Copy link
Member

paulirish commented Oct 5, 2016

  1. if transition is used on transform or opacity. wouldn't do anything for others. also its not guaranteed to be better, but its worth profiling and trying.
  2. instead of translateZ or translate3d.... however safari doesn't support will-change and the layer promotion may still make sense for them. but you'd have to use their devtools to find out.
  3. overflow-auto/scroll on large page elements currently need will-change for lo-dpi (ie. google play and gmail). However, they're about to fix this so we probably dont need to flag these.
  4. position fixed elements on lo-dpi. I don't think above bug also fixed fixed position elements. This is a safer one for the recommendations.
@wardpeet
Copy link
Collaborator

wardpeet commented Oct 5, 2016

@paulirish

  1. correct but in your css you will still have set both if you want to support more than 1 browser. Do we punish them for it or just give them feedback that they need to add will-change as well.
  2. is pretty nice to know :p
  3. Position fixed offers a really bad experience on mobile (ios)...

Something like this?

  1. look for translateZ -> do we also have will-change (it's ok)
  2. if only translateZ warn user for layer promotion?
  3. if they do animation and have translateZ or translate3d but no will-change warn them?
@paulirish
Copy link
Member

...you will still have set both if you want to support more than 1 browser.

  1. aye. if they're already using translateZ or 3d, they might as well add will-change to it. So that's probably rule Work directly against the protocol #2. :)

proposed approach:

  1. if using transition or keyframe animation on transform, opacity, or filter.
    • worth profiling, adding will-change and looking for improvement
  2. if a rule has the null transform hack already, they might as well add will-change (and not remove the existing hack)
  3. Apply to elements that are position:fixed but only in the desktop case
@paulirish paulirish added P3 needs-complete-audit-proposal https://github.com/GoogleChrome/lighthouse/blob/master/docs/new-audits.md and removed needs-priority labels Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-complete-audit-proposal https://github.com/GoogleChrome/lighthouse/blob/master/docs/new-audits.md new_audit P3
4 participants