bokand / bokand.github.io

MIT License
25 stars 6 forks source link

Thoughts on fixed viewport sizing #3

Closed theres-waldo closed 5 years ago

theres-waldo commented 6 years ago

Quoting from the "Fixed viewport size" section of the Web Viewports Explainer:

[In Chrome, t]he fixed viewport is sized to the minimum scale size. ... Since Chrome's the only one that's not sizing the fixed viewport to the ICB, perhaps we should change to that.

I'm trying to understand how that would work more precisely.

It seems to me like there are two sizes we can choosen from:

  1. The size specified by the meta viewport tag.
  2. Something derived from the content size, like the "minimum scale size".

IIUC, Chrome currently sizes the ICB to (1), and the fixed viewport to (2).

If we want the fixed viewport and the ICB are to have the same size, then it seems the options are:

David, could you clarify which of these options you had in mind, or perhaps something else I'm not thinking of?

bokand commented 6 years ago

I originally wanted to go with (1). Having taken a closer look through the webcompat issues in the bugzilla bug though, you're right - it might be a bit challenging with web compat. I wonder if we could run some telemetry and try to estimate based on real data what % of the web this would impact. In particular, pages that load zoomed in are less of a problem than those that load zoomed in but also have overflow-x: hidden since they're rendered unusable.

We definitely don't want to do (2) since the ICB must get its size from the viewport meta tag, I don't think we can change that. (As well as the cyclical dependency you mention).

If we could convince Safari to start respecting overflow: hidden on the root at the same time we could do that in concert. My experience when Chrome started respecting overflow: hidden was that we broke some small fraction of pages but authors quickly changed to fix them since its such a visible issue and easy fix. If it's uncommon enough maybe we could make the breaking change? I also need to better understand what's happening in Safari, the behavior on several of the examples in the bug was surprising to me based on my understanding of how it works.

theres-waldo commented 6 years ago

I wonder if we could run some telemetry and try to estimate based on real data what % of the web this would impact. [...] If it's uncommon enough maybe we could make the breaking change?

Good idea. I filed bug 1423017 to add telemetry to Firefox. Will you add some to Chrome as well?

bokand commented 6 years ago

Yup, filed https://crbug.com/792031 (though I'm off for a week starting tomorrow). Should be able to get it in for Chrome M65.

theres-waldo commented 6 years ago

I wonder if we could run some telemetry and try to estimate based on real data what % of the web this would impact. [...] If it's uncommon enough maybe we could make the breaking change?

Good idea. I filed bug 1423017 to add telemetry to Firefox. Will you add some to Chrome as well?

We added this telemetry to Firefox 62, and now have two release cycles worth of data from it.

Our telemetry classified pages into the following categories:

  1. Page is not overflow-x: hidden OR page is overflow-x: hidden but the page content does not overflow the ICB horizontally.
  2. Page is overflow-x: hidden and the page content overflows the ICB horizontally, but not the minimum scale size.
  3. Page is overflow-x: hidden and the page content overflows the minimum scale size horizontally.

The idea behind this categorization is that:

The numbers show that 5-7% of pages are in category 2, and around 2% of pages are in category 3; the rest are in category 1.

You can see the data e.g. here for Firefox for Android beta 63, and adjust the parameters to see it for other channels. (Note that we don't collect telemetry on the release channel, only on nightly and beta.)

Solution (1) from upthread would break pages in category 2. [Note: They are currently broken in Firefox already, and we'd like to unbreak them. Solution (1) would break them in Chrome as well.] My assessment, based on these numbers, is that this approach is not web compatible.

David, what do you think? Were you able to add similar telemetry to Chrome?

bokand commented 6 years ago

Sorry, this fell off my plate and I never did add the telemetry. Thanks for doing that and the above summary. I'll add that now so that we can at least track it going forward and get some secondary confirmation - unfortunately it'll be ~6 weeks until we can get numbers out of beta.

I agree that ~6% of pages is awfully high for a breaking change. That's much higher than I would have expected from my own usage. Do the Firefox statistics count unique pages or as a proportion of total page loads?

theres-waldo commented 6 years ago

I agree that ~6% of pages is awfully high for a breaking change. That's much higher than I would have expected from my own usage.

Keep in mind, these are pages that work fine in Chrome, so assuming you're using Chrome, I wouldn't really expect them to stand out in any noticeable way.

Do the Firefox statistics count unique pages or as a proportion of total page loads?

I believe they count total page loads.

theres-waldo commented 5 years ago

Just wanted to close the loop here and say that, having determined approach 1 from upthread (size the ICB and the fixed viewport both to the size derived from the meta viewport tag) is not web compatible based on our telemetry, we implemented Chromium's current model (size the ICB to the size derived from the meta viewport tag, size the fixed viewport to the minimum scale size) in Firefox, as described in more detail in #9.

I'm going to close this issue now, but I'd like to note that our implementation is flexible in terms of choosing the size for the fixed viewport, and so if we decide to go with approach 1 at some future time, it should be a straightforward change for us.