Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request makes it possible to dynamically apply unique
view-transition-name
s, making it easier to customise transitions in CSS.Why? View Transitions require unique
view-transition-name
s so it can animate between the two states. For example, in a photo gallery, you might give each photo in the grid a unique name ofimage-:id
(where:id
is unique), which is also applied to the photo when viewing it in full. Customising view transitions in CSS requires referencing theview-transition-name
. However, if each element has a uniqueview-transition-name
then the CSS has to reference each of these names for customisation.w3c/csswg-drafts#8319 has some ideas to improve this, but in the meantime this pull request allows for simple
view-transition-name
s to be applied on-the-fly.How? This pull request adds events to the transition lifecycle. These include:
turn:before-exit
turn:before-transition
turn:before-enter
turn:enter
The
detail
of these events includes:action
:advance
orrestore
initiator
: the element that triggered the visit (a
,form
, orhtml
if a Back/Forward or programmatic visit)referrer
: the URL of the page the visit was triggered fromturn:before-exit
andturn:before-transition
also includenewBody
for customising the incoming markup.With these events, it's possible to annotate links with references to the elements that should transition. For example:
In this way,
view-transition-name
s can be simple, and easily referenceable, e.g.image