feat(ui): fast page transitions with View Transitions
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped

Cross-fades page changes in 160ms on compositor, skips transitions for search query updates, and removes the item-detail fade that would make the new snapshot start blank.
This commit is contained in:
1xDed committed 2026-11-28 16:29:09 +03:00
1 parent 0d2edcab3d
commit 610a7e4dbf
3 files changed
+50 -3

No files matched your search

@@ -93,9 +93,9 @@ const ItemDetailLayout = ({
return (
<motion.div
key={item.Id}
initial={{ opacity: 0 }}
initial={{ opacity: 1 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3, ease: "easeInOut" }}
transition={{ duration: 0.12, ease: "easeOut" }}
className={`scrollY padded-top flex flex-column item item-detail-page item-${variant}`}
ref={containerRef}
>
+5 -1
View File
@@ -44,7 +44,11 @@ const router = createRouter({
},
defaultPreload: false,
defaultPreloadStaleTime: 0,
defaultViewTransition: false,
// Only animate real page changes; search-param updates (typing in the
// search field) must not trigger a transition on every keystroke.
defaultViewTransition: {
types: ({ pathChanged }) => (pathChanged ? ["page"] : false),
},
scrollRestoration: true,
scrollRestorationBehavior: "auto",
});
+43
View File
@@ -98,6 +98,49 @@ body {
opacity: 0.35;
}
/* Fast, compositor-driven page transitions. */
@supports (view-transition-name: none) {
::view-transition-old(root),
::view-transition-new(root) {
animation-duration: 160ms;
animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
animation-fill-mode: both;
}
::view-transition-old(root) {
animation-name: routeFadeOut;
}
::view-transition-new(root) {
animation-name: routeFadeIn;
}
}
@media (prefers-reduced-motion: reduce) {
::view-transition-old(root),
::view-transition-new(root) {
animation: none !important;
}
}
@keyframes routeFadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes routeFadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.fadeIn {
animation: 0.5s fadeInPage forwards;
}