Skip to content

Commit 5a29d4b

Browse files
[Repo Assist] Experiment: View Transition API for smooth cross-document page transitions (issue #1077) (#1080)
* Experiment: add View Transition API CSS for cross-document page transitions (issue #1077) Enable smooth page transitions using the View Transition API: - @view-transition { navigation: auto; } opts all pages in - Named #content with slide-in/slide-out animation on navigation - header, #fsdocs-main-menu, #fsdocs-page-menu update instantly (no fade) - prefers-reduced-motion: all transitions disabled Browser support: Chrome 126+, Safari 18.2+. Gracefully ignored elsewhere. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: trigger checks --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4ec0456 commit 5a29d4b

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

docs/content/fsdocs-default.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,3 +1294,72 @@ dialog {
12941294
opacity: 0.75;
12951295
}
12961296
}
1297+
1298+
/* =========================================================================
1299+
View Transition API — cross-document page transitions (experimental)
1300+
Supported in Chrome 126+, Safari 18.2+. Gracefully ignored elsewhere.
1301+
========================================================================= */
1302+
1303+
@view-transition {
1304+
navigation: auto;
1305+
}
1306+
1307+
/* Isolate the main content area so it can slide independently */
1308+
#content {
1309+
view-transition-name: fsdocs-content;
1310+
}
1311+
1312+
/* Keep persistent navigation panels static (no animation) */
1313+
header {
1314+
view-transition-name: fsdocs-header;
1315+
}
1316+
1317+
#fsdocs-main-menu {
1318+
view-transition-name: fsdocs-main-menu;
1319+
}
1320+
1321+
#fsdocs-page-menu {
1322+
view-transition-name: fsdocs-page-menu;
1323+
}
1324+
1325+
@keyframes fsdocs-slide-in {
1326+
from {
1327+
opacity: 0;
1328+
translate: 0 12px;
1329+
}
1330+
}
1331+
1332+
@keyframes fsdocs-slide-out {
1333+
to {
1334+
opacity: 0;
1335+
translate: 0 -8px;
1336+
}
1337+
}
1338+
1339+
::view-transition-new(fsdocs-content) {
1340+
animation: fsdocs-slide-in 200ms ease both;
1341+
}
1342+
1343+
::view-transition-old(fsdocs-content) {
1344+
animation: fsdocs-slide-out 150ms ease both;
1345+
}
1346+
1347+
/* Nav panels: instant update (old fades out instantly, new fades in instantly) */
1348+
::view-transition-old(fsdocs-header),
1349+
::view-transition-new(fsdocs-header),
1350+
::view-transition-old(fsdocs-main-menu),
1351+
::view-transition-new(fsdocs-main-menu),
1352+
::view-transition-old(fsdocs-page-menu),
1353+
::view-transition-new(fsdocs-page-menu) {
1354+
animation-duration: 0s;
1355+
}
1356+
1357+
/* Respect user's reduced-motion preference */
1358+
@media (prefers-reduced-motion: reduce) {
1359+
::view-transition-group(*),
1360+
::view-transition-image-pair(*),
1361+
::view-transition-old(*),
1362+
::view-transition-new(*) {
1363+
animation-duration: 0s !important;
1364+
}
1365+
}

0 commit comments

Comments
 (0)