-
Notifications
You must be signed in to change notification settings - Fork 17
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
Call back to indicate that the observer is about to stop #43
Comments
I agree that this is a problem! Currently a website could just observe LCP forever (having the observer won't cost anything if it's not receiving entries), but it certainly would be useful to know when a 'final' LCP has been reached. The complexity of this is from a design perspective. We use PerformanceObserver for this, and no other entryType has this kind of problem. So we'd basically need to create a callback unique to this entryType, which does not seem ideal. An alternative would be to re-dispatch the final LCP entry when the algorithm stops due to user input, and have a bit indicating this in the entry. That seems more feasible from my perspective, though a bit less intuitive for developers? |
As far as I can tell, the name field is not currently used for meaningful information by this eventType. If this is indeed the case, a specific value in the field name could be used instead of adding a Boolean (bit) field. And indeed use the same observer callback rather than create some mechanism for having two callbacks on the same observer. |
I think it makes sense to use the name, given that it's currently unused. We can set it to some special value and dispatch the largest entry again when user input occurs and we know the 'final' LCP value. |
Hmmm, I'd be hesitant to use the |
Well, what is a name? :) For instance, on Paint Timing it is used to distinguish |
I was hoping that the |
I have a proposal to address the broader "when is an LCP a real LCP" problem. Give
I know thus far this issue has primarily discussed the problems with detecting item 1, but item 2 seems equally important to not mistake early LCP events for the actual LCP. In scenarios with poor network and device quality this leads to misleading conclusions that attribute FCP to the LCP value and give a falsely rosy picture of page performance. This amounts to creating an absolute stopping point for LCP computation irrespective of user input. If user input occurs before that point then the page has an "unknown" LCP. At a minimum I'm thinking that there shouldn't be any inflight requests for above the fold images with an unknown size or known size larger than the previous largest element, maybe more aggressive network quiet and/or cpu quiet windows as well? Something to think about. |
I'll be presenting this idea probably in the next WebPerf WG call. Slides: https://docs.google.com/presentation/d/1Ll8hMdr7SIqIKLWYf6Nw-5dJQha45BsNQWVHQDzAiSI/edit#slide=id.p |
An update here: we presented the final LCP proposal but have decided not to move forward with it for now because most analytics providers currently dispatch their metrics at early points in time during the page load, like onload. They would not be able to use final-LCP because it may not have dispatched at this time, so using the latest candidate is probably better. As for a signal about when input or scroll has occurred, I don't think there is an easy one right now, but I'm not sure LCP is the right spec to discuss this. @flackr do you know what would be a good place to add a feature request for a signal about the user having scrolled the page (maybe ScrollObserver)? |
Ping @flakr :) Would you have any thoughts on a way to signal to a page that the user has ever scrolled? |
My understanding, per the spec, is that once the user interacts with the page, or even scrolls, LCPs will no longer be recorded via the observer. However, there is no indication of this, so the user of this API has no way of knowing that no additional LCP notifications are forthcoming.
It would be useful to have a callback on the observer, possibly identifiable using the name field, that indicates that user interaction has happened, and that no more LCPs will be recorded.
While user interaction could be identified using FID observer, that will not identify scroll. It is possible to monitor for the scroll using other APIs, but that seems a much more complicated solution.
The text was updated successfully, but these errors were encountered: