-
Notifications
You must be signed in to change notification settings - Fork 74
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
Layout Instability API #374
Comments
The feature seems reasonable to me, in general. I filed some spec issues and posted some pull requests, mostly for editorial stuff. My spec-issues included two more theoretical concerns that perhaps need some consideration (to be discussed on the issues themselves rather than here, probably):
|
I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1651528 on a hypothetical/eventual Firefox implementation of this, BTW. |
I filed one more spec issue on something that could influence our (hypothetical) implementation strategy: |
I've posted a pull request #425 to mark this spec as "worth prototyping". There are some pieces that still need clarity, which I've filed spec issues for[1], and the editors have been responsive on those & hopefully we'll have (or can propose) answers when prototyping. Assuming reasonable resolutions to those issues, the only piece I'm unsure about is whether this can be implemented efficiently such that it's ~zero-cost for sites that don't use the feature, given the requirements of [1] Things that need clarity: [2] Note about cost: WICG/layout-instability#52 (comment) |
I'm a bit late to this but I'm a bit concerned about both the complexity vs. value of it... I think there are some legit reasons for shifting stuff on the screen (like animations and such). From a quick glance at the spec there's nothing that would prevent something like a bouncing animation from reporting a lot of layout shift right? Just something bouncing on screen is not a great example, but something like a parallax effect where stuff moves into view when you scroll seems like a very common thing to do in landing pages and so on, and it seems that'd get counted as layout shift (specially since scroll events are intentionally not excluding inputs, looks like). |
I guess the intention of the 3 pixel shift is to mitigate some of it? But still fast animations would report a lot of shift I think. |
@emilio does this snippet of the explainer address your concerns? (see the sections with titles "Shifting Nodes" and "Transform Changes") (Perhaps those explainer sections need to be better captured in the spec... I am noticing that e.g. the word "transform" never appears in the spec right now.) |
@dholbert it does, to some extent, though:
|
I've now filed WICG/layout-instability#66 on the RE scroll input, I think the spec's snippet about "an Element P" (in section 2.2) is meant to be what excludes scrolling from being considered as layout shift. Though if the site uses additional transform effects for this sort of scrolling, then I think you're correct that it might be counted as shift, per WICG/layout-instability#66 (comment) (but that might be a spec bug & not the spec editors' intended outcome). |
I'm concerned about both the complexity and performance penalty vs. value of this feature. I'm also concerned about the privacy implications of the data collection this enables. If I understand correctly, this API is exposed to non-privileged web content, but that seems unnecessary if we only want to visualize these metrics in Firefox devtools for example. I'm fine with standardizing private (not exposed to web-content) APIs that devtools can use to present comparable performance metrics to web developers across browsers, but I'm opposed to adding more ways for mass-surveillance companies like Google and Facebook to collect privacy-sensitive data. |
I'm also concerned about the long term consequences for the web if performance metrics like this are incorporated into SEO scoring and such. It seems to me this would act as a forcing function that will lead to more centralization of resources (such as downloadable fonts), which I think is undesirable. |
The intent here is not meant for this API to mainly serve Dev Tools. The idea is that this API serves as a RUM that can be used by websites as telemetry to track the experience actual users are having on their site. See also Google's post here: https://web.dev/vitals/ I haven't yet thought of any 'real' privacy concerns with this particular feature but I'd be very interested in hearing them. As to performance metrics being incorporated in SEO, I'm not particularly excited by that myself, but that is not really under our control. The best we can do in my opinion is make sure that if performance metrics are going to be incorporated in SEO, they're the best possible metrics we can make them. |
I chatted with mats and I think this argument is not valid because of cache partitioning, fwiw. But I have some other comments, which make me lean towards Mats' argument... What is the benefit for a website having access to this data outside of analysis of page loads which can be performed on devtools / with different network speeds, etc? Is the idea to monitor this data across time to measure the "health" of the website? I'm also concerned about legit user actions (like zooming in and out, resizing or such) which are going to cause a lot of shift aren't they? And they wouldn't be covered by the spec. How do you avoid these or help discard them? |
The reality of performance testing on the web shows us that what shifts you actually get are wildly, and I do mean wildly different on a per device/per user basis. Many things affect this like the order in which resources come in on a particular device (which isn't just a consequence of end-user network speed but many other factors). The speed at which the browser runs certain work and therefor the scheduling of things. You can design an impossibly large testing matrix to try and account for this, but the reality is that that is incredibly hard to do, even for large organizations, and possible more important, impossible to do for smaller content creators. Therefore, yes, if you're a website trying to monitor this data for your users (across time as well as for a single point in time), local testing is not a great option. If pageload were a much more deterministic process I might be more sympathetic to that argument, but both the data sites are getting from Google's API as the results of our own performance testing show us that it isn't. I certainly see value in exposing this as a RUM for content creators. |
If I understand you correctly I believe those concerns are meant to be addressed by the hadRecentInput/LastInputTime attributes. See also section 2.4 and 5.1 in the spec. |
Those inputs aren't always accessible to the website usually, right? for example if you change zoom with your browser UI, the content tab has no information about any event... |
Anyhow, it's not a huge deal, just something that I think at least should be better defined... |
Ah, here's the sentence I missed on the spec:
That makes sense and I guess covers the two cases I thought about :) |
* Standards Position for Layout Instability API This closes #374 * Add a mention that we've filed some spec issues (per tantek's suggestion). * be internally consistent about using two spaces between sentences
Request for Mozilla Position on an Emerging Web Specification
Other information
Explainer: https://github.com/WICG/layout-instability/blob/master/README.md
TAG review: w3ctag/design-reviews#393
The text was updated successfully, but these errors were encountered: