You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-view-transitions-2/Overview.bs
+34-1Lines changed: 34 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -139,13 +139,46 @@ See the <a href="#lifecycle">lifecycle</a> section for more details.
139
139
140
140
### Waiting for the new state to stabilize ### {#waiting-for-stable-state}
141
141
In same-document view transitions, the author can indicate when the new state of the transition is in a stable state by using the callback passed to {{Document/startViewTransition}}.
142
-
Since cross-document view transitions are declarative, there is no such explicit promise. Instead, the user agent relies on the [=render-blocking mechanism=] to decide when the stable state is ready.
142
+
Since cross-document view transitions are declarative, there is no such explicit promise. Instead, the user agent relies on the [=render-blocking mechanism=] to decide when the document has reached a stable state.
143
143
In this way, the author can use the the <code data-x="">blocking</code> attribute, to delay the transition until:
144
144
* All expected scripts are executed, by using the script's {{HTMLScriptElement/blocking}} attribute on required scripts.
145
145
* All expected styles are executed, by using the style or link's {{HTMLStyleElement/blocking}} attribute on required styles.
146
146
* All expected HTML elements are seen by the parser, using an <{link/rel/expect}>{{HTMLLinkElement}} element.
147
147
148
+
Note: overusing the render-blocking mechanism could make it so that the old state remains frozen for a long time, resulting in a jarring user experience.
149
+
To avoid this, it's advised to ensure that the render-blocking elements are available in a timely manner.
150
+
148
151
<div class="example">
152
+
153
+
In this example, the last frame of the old document will be shown, and the animation will be delayed, until all the following conditions are met:
154
+
- `style.css` is applied, to ensure the new state has the correct styles
155
+
- `fixup.js` is run, to ensure the presentation is up to date with script-based fixups.
156
+
- The `main-article` section is seen and parsed, to ensure enough of the content is loaded before allowing the transition to proceed.
157
+
158
+
```html
159
+
<!DOCTYPE html>
160
+
<html>
161
+
<head>
162
+
< !-- This will be render-blocking by default -->
163
+
<link rel="stylesheet" href="style.css">
164
+
165
+
< !-- Since this script fixes up the layout, marking it as render blocking will
166
+
ensure it's run before the view transition is activated -->
0 commit comments