Description
In #7859 we resolved on the concept of a "snapshot viewport", which would be consistent regardless of things like URL bar, virtual keyboard, and scrollbars, meaning animations would be stable, even if those things only existed on one side of the transition.
This means ::view-transition
would fill this snapshot viewport throughout the transition.
We see two options to achieve this:
Option 1: Position ::view-transition
per frame
::view-transition
would use regular position: fixed
positioning. inset: 0
would only fill the layout viewport, which is often smaller than the snaphshot viewport. So, to fix this, negative inset
values would be used to make ::view-transition
fill the snapshot viewport. These values would be updated per frame, to ensure the positioning is correct during any state changes (eg url bar hiding/showing).
This would be developer-visible via getComputedStyle
, and would behave differently if the position was set to a non-fixed value.
In browsers that use a compositor to manage position: fixed
items, there's a worry that there may be rendering instability in frames where the compositor is 'ahead' of the main thread's updates to the inset
.
Option 2: Layout ::view-transition
within the "snapshot viewport"
The ::view-transition
would have position: fixed; inset: 0
. However, we would use spec prose to say this pseudo is laid out in the snapshot viewport, so position: fixed; inset: 0
would cause ::view-transition
to fill the snapshot viewport, rather than the layout viewport.
This wouldn't have the compositor issues, as it isn't dependent on main thread style updates. However, it's perhaps a bit weird for this one pseudo to appear to treat layout differently. Is there anything else that does something similar?
We're leaning towards "option 2".