NEW 285400
[view-transitions] ::view-transition-group() animations are not using the Snapshot Containing Block
https://bugs.webkit.org/show_bug.cgi?id=285400
Summary [view-transitions] ::view-transition-group() animations are not using the Sna...
Bramus
Reported 2025-01-05 08:01:05 PST
Created attachment 473780 [details] iOS Simulator Screenshot When inspecting the keyframes generated for ::view-transition-group() pseudos, it seems like they are not using the Snapshot Containing Block. See the attached screenshot where Safari is set to Single Tab mode. The top position of the box (`24px`, derived from the `matrix` property) is measured against the Viewport, not the [Snapshot Containing Block](https://drafts.csswg.org/css-view-transitions-1/#snapshot-containing-block-concept). The demo used is https://cdpn.io/pen/debug/NPKgvMY, which dumps the keyframes. (Note that the `from` keyframe is entirely wrong. This is tracked in https://bugs.webkit.org/show_bug.cgi?id=285277)
Attachments
iOS Simulator Screenshot (972.31 KB, image/png)
2025-01-05 08:01 PST, Bramus
no flags
Recording of https://cdpn.io/pen/debug/ZYzvjZb (4.41 MB, video/quicktime)
2025-01-07 07:14 PST, Bramus
no flags
Bramus
Comment 1 2025-01-05 13:27:23 PST
Or does WebKit compute the x,y against the Snapshot Containing Block and then converts them to values relative to the (new) Viewport?
Bramus
Comment 2 2025-01-07 03:55:30 PST
Here’s a demo that makes it easier to verify/reproduce: https://cdpn.io/pen/debug/ByBJVwp It animates the box to the top-left corner and back to the center upon tapping, instead of randomly setting the alignments. Steps to reproduce: 0. **Make sure Safari is set to Single Tab mode** 1. Open https://cdpn.io/pen/debug/ByBJVwp in Safari on iOS 2. Tap the document to animate the box to the top-left corner 3. Note the `ty` value used in the `transform` from the logged `toKeyframe` 4. Open https://cdpn.io/pen/debug/ByBJVwp in Safari on iOS 5. Scroll down 6. Tap the document to animate the box to the top-left corner 7. Note the `ty` value used in the `transform` from the logged `toKeyframe` Expected Results: - The values noted in steps 3 and 7 should **not** be the same. Actual Results: - The logged values are the same
Tim Nguyen (:ntim)
Comment 3 2025-01-07 06:40:39 PST
We don't currently implement the snapshot containing block, I hadn't prioritized it, given the default on iOS is the bottom navigation bar, where it makes less difference. It does make more difference in single-tab mode and Android though where there is a collapsible navigation bar on top of the screen, so we should definitely address this at some point.
Bramus
Comment 4 2025-01-07 07:12:58 PST
Thanks for confirming. Here’s another demo – this time MPA – that might help while implementing things: https://cdpn.io/pen/debug/ZYzvjZb. You click the link shown at the top right to navigate to the next page, upon which the box moves using a View Transition. When having scrolled down first – even in Tab Bar Mode – you can see that the start position of the `::view-transition-group(box)` is off. (For reference: Chrome on Android re-shows the address bar before starting the transition, circumventing this situation altogether)
Bramus
Comment 5 2025-01-07 07:14:21 PST
Radar WebKit Bug Importer
Comment 6 2025-01-12 08:02:15 PST
Note You need to log in before you can comment on or make changes to this bug.