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

[css-transforms][css-overflow] Need to better define how transform affects scrollable overflow. #9458

Open
dbaron opened this issue Oct 11, 2023 · 2 comments
Labels
css-overflow-3 Current Work css-transforms-1 Current Work

Comments

@dbaron
Copy link
Member

dbaron commented Oct 11, 2023

The descriptions of how CSS transforms affect scrollable overflow currently contain both (a) contradictions between specs (b) disagreements between specs and implementations and (c) lack of interoperability between implementations.


The overflow module has a definition of scrollable overflow that basically says that transformed elements are considered only at the transformed position when computing scrollable overflow. (This is considering only 2D transforms for now; there are some more interesting questions related to 3D transforms around both 3D scenes (as noted in the spec prose) and around perspective (see #3322).)

The transforms module, on the other hand, contains both the sentence:

Transforms affect the computation of the scrollable overflow region as described by [CSS-OVERFLOW-3].

and then later has the paragraph (which I strongly suspect is much older, but haven't checked):

For elements whose layout is governed by the CSS box model, the transform property does not affect the flow of the content surrounding the transformed element. However, the extent of the overflow area takes into account transformed elements. This behavior is similar to what happens when elements are offset via relative positioning. Therefore, if the value of the overflow property is scroll or auto, scrollbars will appear as needed to see content that is transformed outside the visible area. Specifically, transforms can extend (but do not shrink) the size of the overflow area, which is computed as the union of the bounds of the elements before and after the application of transforms.

The last sentence specifically says the opposite of what the algorithm in the overflow spec does -- this sentence says that transformed elements influence the overflow area from both their untransformed position and their transformed position.


So what do implementations do?

Let's start by considering this testcase where the transformed element's original position causes a scrollbar, but transformed position does not and then this testcase where the transformed element's transformed position causes a scrollbar, but the original position does not. Based on these testcases, it appears that Chrome and Safari consider the transformed element at only its transformed position, whereas Firefox considers the transformed element at both its untransformed position and its transformed position.

However, we can consider the conceptually more complicated (but physically simpler) testcase where the transformed element's original position also affects the size of an imaginary anonymous box inside of the scroll container, then the original position affects the height of the scrollbar in all three implementations. This doesn't particularly surprise me (since it's essentially like there's a box on the inside of the scroll container that expands to hold its contents). This remains true in this testcase where the scrollable container is the viewport.

I don't think we have any specification text that explains the difference between these two scenarios, since I think we've generally avoided specifying that there's any anonymous box inside of a scrollable container. It's not clear to me how we would specify that difference.

We can then consider the additional testcase variant that is like the previous one, except that the transformed element is the root element. In this case Firefox and Safari no longer make the viewport scroll to reach the original position of the transformed root element, whereas Chrome does. Without a coherent explanation for the difference between the first pair of scenarios (at least outside of Firefox, which largely (except for this case!) follows the original spec of using both the untransformed and the transformed positioned), it's hard to tell which behavior is correct for this case because we don't clearly know what to consider, and I also don't think we have a clear definition of what scrollable overflow area causes the viewport to be scrollable.


For extra fun, a form of this last testcase is part of Interop2023 (as part of a test for something else, the interaction of transforms and background drawing on the root element), and was adjusted in web-platform-tests/wpt#36476 from requiring one behavior to almost requiring the other (modulo, I think, an error of 8px for the default margin on the root). (I intend to propose modifying the test so either behavior passes.)

cc @mattwoodrow @nt1m @dholbert @emilio

dbaron added a commit to dbaron/web-platform-tests that referenced this issue Oct 11, 2023
… scrollable overflow.

These tests are intended to test the effect of transform on the root
element on backgrounds that are propagated to the canvas.  They
coincidentally also test the effect of a transformed root element on the
scrollable overflow that applies to the viewport's scrollbars.

The scrollbar issue is underspecified as described in
w3c/csswg-drafts#9458, and implementations differ as to how a
transformed root element affects scrollbar extents on the viewport.

Because of this, this change replaces the previous adjustment of these
tests in web-platform-tests#36476 (from matching some
implementations to matching others) with a change to the tests so that
they no longer test the extent of scrollbars on the root element.
dbaron added a commit to web-platform-tests/wpt that referenced this issue Oct 12, 2023
… scrollable overflow (#42493)

These tests are intended to test the effect of transform on the root
element on backgrounds that are propagated to the canvas.  They
coincidentally also test the effect of a transformed root element on the
scrollable overflow that applies to the viewport's scrollbars.

The scrollbar issue is underspecified as described in
w3c/csswg-drafts#9458, and implementations differ as to how a
transformed root element affects scrollbar extents on the viewport.

Because of this, this change replaces the previous adjustment of these
tests in #36476 (from matching some
implementations to matching others) with a change to the tests so that
they no longer test the extent of scrollbars on the root element.
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 26, 2023
… of the root element not test scrollable overflow, a=testonly

Automatic update from web-platform-tests
Make tests for transforms on backgrounds of the root element not test scrollable overflow (#42493)

These tests are intended to test the effect of transform on the root
element on backgrounds that are propagated to the canvas.  They
coincidentally also test the effect of a transformed root element on the
scrollable overflow that applies to the viewport's scrollbars.

The scrollbar issue is underspecified as described in
w3c/csswg-drafts#9458, and implementations differ as to how a
transformed root element affects scrollbar extents on the viewport.

Because of this, this change replaces the previous adjustment of these
tests in web-platform-tests/wpt#36476 (from matching some
implementations to matching others) with a change to the tests so that
they no longer test the extent of scrollbars on the root element.
--

wpt-commits: 1e1d4055cf9f4b361f8e7052c681a3f2776d214d
wpt-pr: 42493
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this issue Oct 27, 2023
… of the root element not test scrollable overflow, a=testonly

Automatic update from web-platform-tests
Make tests for transforms on backgrounds of the root element not test scrollable overflow (#42493)

These tests are intended to test the effect of transform on the root
element on backgrounds that are propagated to the canvas.  They
coincidentally also test the effect of a transformed root element on the
scrollable overflow that applies to the viewport's scrollbars.

The scrollbar issue is underspecified as described in
w3c/csswg-drafts#9458, and implementations differ as to how a
transformed root element affects scrollbar extents on the viewport.

Because of this, this change replaces the previous adjustment of these
tests in web-platform-tests/wpt#36476 (from matching some
implementations to matching others) with a change to the tests so that
they no longer test the extent of scrollbars on the root element.
--

wpt-commits: 1e1d4055cf9f4b361f8e7052c681a3f2776d214d
wpt-pr: 42493
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 30, 2023
… of the root element not test scrollable overflow, a=testonly

Automatic update from web-platform-tests
Make tests for transforms on backgrounds of the root element not test scrollable overflow (#42493)

These tests are intended to test the effect of transform on the root
element on backgrounds that are propagated to the canvas.  They
coincidentally also test the effect of a transformed root element on the
scrollable overflow that applies to the viewport's scrollbars.

The scrollbar issue is underspecified as described in
w3c/csswg-drafts#9458, and implementations differ as to how a
transformed root element affects scrollbar extents on the viewport.

Because of this, this change replaces the previous adjustment of these
tests in web-platform-tests/wpt#36476 (from matching some
implementations to matching others) with a change to the tests so that
they no longer test the extent of scrollbars on the root element.
--

wpt-commits: 1e1d4055cf9f4b361f8e7052c681a3f2776d214d
wpt-pr: 42493

UltraBlame original commit: 65ff0f1ee0d9596c319feff1f316070abd67b601
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 30, 2023
… of the root element not test scrollable overflow, a=testonly

Automatic update from web-platform-tests
Make tests for transforms on backgrounds of the root element not test scrollable overflow (#42493)

These tests are intended to test the effect of transform on the root
element on backgrounds that are propagated to the canvas.  They
coincidentally also test the effect of a transformed root element on the
scrollable overflow that applies to the viewport's scrollbars.

The scrollbar issue is underspecified as described in
w3c/csswg-drafts#9458, and implementations differ as to how a
transformed root element affects scrollbar extents on the viewport.

Because of this, this change replaces the previous adjustment of these
tests in web-platform-tests/wpt#36476 (from matching some
implementations to matching others) with a change to the tests so that
they no longer test the extent of scrollbars on the root element.
--

wpt-commits: 1e1d4055cf9f4b361f8e7052c681a3f2776d214d
wpt-pr: 42493

UltraBlame original commit: 65ff0f1ee0d9596c319feff1f316070abd67b601
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 30, 2023
… of the root element not test scrollable overflow, a=testonly

Automatic update from web-platform-tests
Make tests for transforms on backgrounds of the root element not test scrollable overflow (#42493)

These tests are intended to test the effect of transform on the root
element on backgrounds that are propagated to the canvas.  They
coincidentally also test the effect of a transformed root element on the
scrollable overflow that applies to the viewport's scrollbars.

The scrollbar issue is underspecified as described in
w3c/csswg-drafts#9458, and implementations differ as to how a
transformed root element affects scrollbar extents on the viewport.

Because of this, this change replaces the previous adjustment of these
tests in web-platform-tests/wpt#36476 (from matching some
implementations to matching others) with a change to the tests so that
they no longer test the extent of scrollbars on the root element.
--

wpt-commits: 1e1d4055cf9f4b361f8e7052c681a3f2776d214d
wpt-pr: 42493

UltraBlame original commit: 65ff0f1ee0d9596c319feff1f316070abd67b601
@bfgeek
Copy link

bfgeek commented Mar 13, 2024

I'd strongly prefer if we keep Blink/WebKit behaviour here - e.g. only use the transformed position for the individual contribution. Developers often transform OOFs away to not contribute to overflow, e.g.
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=12449

... and Firefox is doing something funky in that it isn't treating the axes the same here.

For changing how an item contributes I'd like to rely on the (unnamed) #8361 property.

@astearns astearns removed the Agenda+ label Mar 13, 2024
@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-transforms][css-overflow] Need to better define how transform affects scrollable overflow..

The full IRC log of that discussion <TabAtkins> dbaron: quesiton is how to do this quickly. I think I should just intro it and then discuss in the issue.
<TabAtkins> dbaron: Two underlying issues here, perhaps shoudl ahve separated them.
<TabAtkins> dbaron: One of the two affects many testcases you'd write for the second one.
<TabAtkins> dbaron: One problem, Transforms and Overflow both have a definitinon of how transforms affect scrolalble overflow, and they disagree
<TabAtkins> dbaron: It appears blink/webkit implement overflow, gecko implements transform
<TabAtkins> dbaron: Transform says transformed elements affet overflow both at their initial position and their transformed position
<TabAtkins> dbaron: Overflow says they only do it at their transformed position
<TabAtkins> dbaron: Ian has a comment that he strongly prefers the blink/webkit behavior, he thinks devs use this to avoid contributing to overflow sometimes
<TabAtkins> dbaron: Second issue, we keep running into issues where the fact that impls do scrolalble overflow by wrapping the thing inside the scrollbars with a block, and we somehow word the spec to avoid actually mentioning that
<TabAtkins> dbaron: Underneath, when impls do overflow by wrapping things in a block, if the last thing in the block is transformed up, if you use the Overflow spec dfn, there's nothing left to keep the scrollbar exposing that last bit. But impls do reserve that space.
<TabAtkins> dbaron: We keep working around the issue, but I think this isn't doable. And I don't think we can remove it. So we should define it.
<TabAtkins> dbaron: So this is complicated. I'd like people to say what they think in the issue.
<kizu> q+
<astearns> ack kizu
<TabAtkins> kizu: I'll comment in the issue. Note there's an Oriol proposal about ::contents pseudo, because I think this also includes this.
<kizu> Issue for the contents pseudo-element: github.com//issues/2406
<TabAtkins> astearns: Okay, taking this back to the issue. Thanks for the intro.
<TabAtkins> astearns: I'll leave it to david on whether ot break this into issuess
<TabAtkins> fantasai: As the editor of Overflow, I'd love it if we can settle on a description, this is one of a handful of things blocking CR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-overflow-3 Current Work css-transforms-1 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants