Re: [csswg-drafts] [css-contain-4] c-v: auto elements painted into snapshots for View Transitions (#8060)

Posting a summary and updated proposal from an offline discussion:

1. C-V: auto element with a descendant participating in transition
After the resolution at https://github.com/w3c/csswg-drafts/issues/7874#issuecomment-1309141936, if an element skips its contents then its descendants are not eligible to participate in a view transition. The descendants are skipped when discovering participating elements [here](https://www.w3.org/TR/css-view-transitions-1/#setup-view-transition-algorithm) : "If any [flat tree](https://drafts.csswg.org/css-scoping-1/#flat-tree) ancestor of this element [skips its contents](https://drafts.csswg.org/css-contain-2/#skips-its-contents), then [continue](https://infra.spec.whatwg.org/#iteration-continue)."

   So this case is limited to the ancestor of a participating element becoming skippable mid-transition. There is a conceptual intersection between this and the discussion in #7882. If we used the same strategy, we'd skip the transition. But given that skipping a c-v: auto element's contents is dependent on browser heuristics, it's possible for the case to occur without a developer error. For example, more content loading pushing an element down. So the preference is to err on avoiding visual abruptness (by aborting the transition) and keeping the c-v: auto element unlocked throughout the transition.

   **Proposed Resolution**: Element with c-v: auto continues to stay relevant to the user if it has descendants which participate in a transition.

2. C-V: auto element with ancestor participating in transition
This case has a c-v: auto element which is being captured in it's ancestor's image [here](https://www.w3.org/TR/css-view-transitions-1/#capture-the-image). The c-v: auto element itself could be offscreen and be skipping its contents. But it's painting could come onscreen based on the geometry of the pseudo-element which will display the snapshot.

   There is a performance vs visual correctness trade-off here. We'd continue skipping the contents to retain the performance optimization that c-v: auto is supposed to provide. But make the element relevant given the possibility that it's painting *could* be displayed onscreen. We're erring on the side of prioritizing performance since developers are more likely to notice visual correctness issues if they need the element to stay relevant. And they have an easy way to ensure that by switching from c-v: auto to c-v: visible.

   **Proposed Resolution**: Element with c-v: auto is not forced to become relevant to the user if painted in an ancestor's snapshot for view transitions.

We still need to clarify what happens if an elements gets `visibility: hidden` or `content-visibility: hidden` mid transition, will file a separate issue for that.


-- 
GitHub Notification of comment by khushalsagar
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8060#issuecomment-1377689882 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 10 January 2023 18:38:51 UTC