@@ -101,9 +101,8 @@ const { fallback = 'animate' } = Astro.props as Props;
101
101
102
102
const parser = new DOMParser();
103
103
104
- async function updateDOM(dir: Direction, html: string, state?: State, fallback?: Fallback) {
104
+ async function updateDOM(html: string, state?: State, fallback?: Fallback) {
105
105
const doc = parser.parseFromString(html, 'text/html');
106
- doc.documentElement.dataset.astroTransition = dir;
107
106
108
107
// Check for a head element that should persist, either because it has the data
109
108
// attribute or is a link el.
@@ -233,15 +232,17 @@ const { fallback = 'animate' } = Astro.props as Props;
233
232
location.href = href;
234
233
return;
235
234
}
235
+ document.documentElement.dataset.astroTransition = dir;
236
236
if (supportsViewTransitions) {
237
- finished = document.startViewTransition(() => updateDOM(dir, html, state)).finished;
237
+ finished = document.startViewTransition(() => updateDOM(html, state)).finished;
238
238
} else {
239
- finished = updateDOM(dir, html, state, getFallback());
239
+ finished = updateDOM(html, state, getFallback());
240
240
}
241
241
try {
242
242
await finished;
243
243
} finally {
244
- document.documentElement.removeAttribute('data-astro-transition');
244
+ // skip this for the moment as it tends to stop fallback animations
245
+ // document.documentElement.removeAttribute('data-astro-transition');
245
246
await runScripts();
246
247
markScriptsExec();
247
248
onload();
@@ -291,8 +292,7 @@ const { fallback = 'animate' } = Astro.props as Props;
291
292
transitionEnabledOnThisPage()
292
293
) {
293
294
ev.preventDefault();
294
- navigate('forward', link.href, { index: currentHistoryIndex, scrollY: 0 });
295
- currentHistoryIndex++;
295
+ navigate('forward', link.href, { index: ++currentHistoryIndex, scrollY: 0 });
296
296
const newState: State = { index: currentHistoryIndex, scrollY };
297
297
persistState({ index: currentHistoryIndex - 1, scrollY });
298
298
history.pushState(newState, '', link.href);
0 commit comments