Skip to content

Commit b1fa799

Browse files
authored
Refine CSS navigation preview handling
Updated CSS rules for navigation preview states to enhance animation control.
1 parent 3ea4d89 commit b1fa799

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

css-view-transitions-2/two-phase-transition-explainer.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,21 @@ Specifically, the `addRestoreCallback` mechanism can be easily overlooked by dev
9191
As an alternative, proposing a declarative CSS-based solution, based on view-transition at rules and `@navigation` conditionals:
9292

9393
```css
94-
@navigation(preview) {
94+
@navigation(preview: active) {
9595
#skeleton {
9696
display: block;
9797
}
98+
99+
::view-transition-group(*) {
100+
animation-iteration-count: infinite;
101+
}
102+
}
103+
104+
@navigation(preview: exiting) {
105+
::view-transition-group(*) {
106+
/* this would stop the infinite animation, letting it complete */
107+
animation-iteration-count: 1;
108+
}
98109
}
99110

100111
@view-transition {
@@ -104,7 +115,7 @@ As an alternative, proposing a declarative CSS-based solution, based on view-tra
104115
```
105116

106117
The "preview" animation with its attached types would start when the navigation is initiated (but not intercepted), and would defer the commit until
107-
it is finished. The "new" state of the animation would be controlled by style only, using the `@navigation(preview)` conditional (which can be mixed and matches with other conditionals).
118+
it is finished. The "new" state of the animation would be controlled by style only, using the `@navigation(preview: active)` conditional (which can be mixed and matches with other conditionals).
108119

109120
## Pros and cons of the different solutions
110121

0 commit comments

Comments
 (0)