- From: Bramus via GitHub <sysbot+gh@w3.org>
- Date: Tue, 25 Feb 2025 20:31:44 +0000
- To: public-css-archive@w3.org
> I agree it is a gap in the API that web developers have no way to determine the geometry of the snapshot containing block in relation to the layout viewport. Yesterday I found a workaround while discussing some things with @vmpstr, but the hack is nasty: - Posfix an element at `0,0` - Start a View Transition with that element - Read the viewport-relative position using a `getBoundingClientRect` - Extract the SCB-relative position from the `::v-t-group()`’s keyframes - Compute the difference between both `y` values With that number available, one can manually take it into account when fiddling with the keyframes. It would be more convenient if that value was exposed through some other way. @vmpstr was thinking of an `env()`-var for this. --- Personally I would love to see the automatic conversion happen, as that’s easy for authors. As I commented on the linked to crbug: > I believe that the only proper solution would be to normalize the keyframes to be viewport relative whenever they are touched by authors: > > - `groupAnimation.effect.getKeyframes`: Expose those coordinates as viewport relative. > - `groupAnimation.effect.setKeyframes`: Treat those coordinates as viewport relative. > > Internally the SCB-relative coordinates can still be used, and my suggestion is that the engine would auto-convert back and forth between the two coordinate spaces. > > That would allow: > > - `groupAnimation.effect.getKeyframes()`: authors can now use the reported coordinates to position elements onto those locations > - `groupAnimation.effect.setKeyframes(customKeyframes)`: the group pseudo no longer “jumps up” by `<height-of-the-retractable-top-bar>`. > - `groupAnimation.effect.setKeyframes(groupAnimation.effect.getKeyframes())`: this still works because the engine auto-converts in both the getter and the setter. > > The benefit to authors here is that don’t need to do anything: it just works. But I would also be happy with an `env()` var to take into account. -- GitHub Notification of comment by bramus Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11456#issuecomment-2683218943 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 25 February 2025 20:31:45 UTC