Comments (3)
This is a very interesting one! And I had to pull out some favours with some CSS colleagues to figure it out.
Apparently applying filter
is one of the properties that creates a new stacking context so, as that's added and removed as you hover over it, that's causing a slight recalc in the CSS which technically causes a change in the pseudo elements position (even though there's no visible change to the user).
The easiest way to prevent this is to create that new stacking context in advance, by uncommenting one of the two properties below:
.overlay-container {
transition: filter 0.2s ease-in-out;
/* filter: brightness(1); */
/* will-change: filter; */
The first (filter: brightness(1);
) sets the filter property even in unhovered state to the default of 1 so it has a filter
value and knows therefore that it needs it's own stacking context for when you change this default later.
The second (will-change: filter;
) explicitly tells the browser that it needs it's own stacking context as a filter is going to be changed later. It's probably the cleaner of these two options as doesn't require you to explicitly set a default value (that might interfere with other CSS you have).
Should Chrome count this as CSS when there is no user-visible change? No, it probably shouldn't. So feel free to raise a bug at crbug.com/new, however it's quite a minor one in this case (do let us know if you have a bigger example!) and it'll actually be ever so slightly more performant to do the solution above, so I imagine it won't be the biggest priority to look at this.
Oh and btw, on that note, Chrome-specific issues should be raised to crbug.com or to our web-vitals-feedback group, rather than here. This repo is specifically for the web-vitals.js library and this issue could have been repeated with a layout-shift performance observer even outside the library (though you may not have realised that!).
from web-vitals.
UPDATE: using the
will-change
property fixes the issue on our end as well 💯
Excellent! Great to hear.
from web-vitals.
UPDATE: using the will-change
property fixes the issue on our end as well 💯
Thanks for looking into this and for the suggestions. I guess on our end, I still need to figure out why the numbers we're seeing are larger than the reproducible example I sent above but in the meantime, I'll apply your suggestion and move on.
Oh and btw, on that note, Chrome-specific issues should be raised to crbug.com rather than here, or to our web-vitals-feedback group. This repo is specifically for the web-vitals.js library and this issue could have been repeated with a layout-shift performance observer even outside the library (though you may not have realised that!).
That makes sense. I wasn't sure where the problem was, good to know for next time.
from web-vitals.
Related Issues (20)
- differences in TTFB in safari vs chromium based browsers HOT 1
- LCP value setting to 0 intermittently HOT 7
- Add INP breakdown entries to the attribution build HOT 3
- User consent policy HOT 1
- Firefox LCP tests failing
- Bug: LCP attribution can include `resourceLoadDelay` attribution timings far greater than the LCP value in cases where `onTTFB` discards the navigation data HOT 1
- FCP and TTFB are triggered multiple times HOT 7
- contributing LoAF basesd code that idenifies LoAF, INF and JS long tasks data HOT 1
- Capturing metadata with events HOT 2
- Allow to reset the INP calculation HOT 2
- v4 giving undefined TypeError HOT 1
- INP: Probably a bad measurement metric for web vitals - even with simple HTML structure pages with no CSS will cause bad value. HOT 1
- Expose INP target element as first class citizen in attribution HOT 3
- Expose ability to reset internal state of metrics (specifically INP) HOT 2
- v4 INP attribution ending processingEnd time in the wrong animation frame HOT 8
- CDN JS - Web server is returning an unknown error HOT 4
- CLS and INP are being calculated incorrectly HOT 2
- Suggestion to track all attributions HOT 4
- Firefox e2e tests flakey HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-vitals.