-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix flickering during view transitions (#8772)
* Fix for #8711 * more descriptive changeset * chores, while we are at it ...
- Loading branch information
Showing
6 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fix flickering during view transitions |
34 changes: 34 additions & 0 deletions
34
packages/astro/e2e/fixtures/view-transitions/src/components/listener-layout.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
import { ViewTransitions } from 'astro:transitions'; | ||
--- | ||
<html> | ||
<head> | ||
<ViewTransitions/> | ||
</head> | ||
<body> | ||
<p>Local transitions</p> | ||
<slot/> | ||
<script> | ||
document.addEventListener("astro:after-swap", () => { | ||
document.querySelector("p").addEventListener("transitionstart", () => { | ||
console.info("transitionstart"); | ||
}); | ||
document.documentElement.setAttribute("class", "blue"); | ||
}); | ||
document.dispatchEvent(new Event("astro:after-swap")); | ||
</script> | ||
</body> | ||
<style> | ||
p { | ||
transition: background-color 1s; | ||
} | ||
p { | ||
background-color: #0ee; | ||
color: red; | ||
} | ||
.blue p { | ||
background-color: #ee0; | ||
color: blue; | ||
} | ||
</style> | ||
</html> |
6 changes: 6 additions & 0 deletions
6
packages/astro/e2e/fixtures/view-transitions/src/pages/listener-one.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
import ListenerLayout from '../components/listener-layout.astro'; | ||
--- | ||
<ListenerLayout> | ||
<a id="totwo" href="/listener-two">Go to listener two</a> | ||
</ListenerLayout> |
6 changes: 6 additions & 0 deletions
6
packages/astro/e2e/fixtures/view-transitions/src/pages/listener-two.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
import ListenerLayout from '../components/listener-layout.astro'; | ||
--- | ||
<ListenerLayout> | ||
<a id="toone" href="/listener-one">Go to listener one</a> | ||
</ListenerLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters