Skip to content

Commit 86e4109

Browse files
authored
Disable workshop page transition animation (#2395)
1 parent 6a684de commit 86e4109

3 files changed

Lines changed: 8 additions & 51 deletions

File tree

scripts/build-docs.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ test("workshop navigation constrains long buttons on small screens", () => {
5858
assert.ok(css.includes(".workshop-nav-btn {\n box-sizing: border-box;\n max-width: 100%;\n width: 100%;"));
5959
});
6060

61+
test("workshop page navigation does not animate page changes", () => {
62+
const { html, css } = buildDocs();
63+
64+
assert.ok(!html.includes("startViewTransition"));
65+
assert.ok(!css.includes("view-transition"));
66+
});
67+
6168
test("current page checkpoint progress renders in the sticky header", () => {
6269
const { html, css, checkboxesJs } = buildDocs();
6370

scripts/lib/docs.css

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,43 +1278,3 @@ html[data-color-mode="dark"] .yaml-editor-block .code-copy-btn:hover {
12781278
background-color: #161b22;
12791279
color: #e6edf3;
12801280
}
1281-
1282-
/* ========================
1283-
CSS View Transitions
1284-
======================== */
1285-
@media (prefers-reduced-motion: no-preference) {
1286-
.markdown-body > details[open] {
1287-
view-transition-name: workshop-page;
1288-
}
1289-
1290-
@keyframes vt-slide-in-right {
1291-
from { opacity: 0; transform: translateX(48px); }
1292-
to { opacity: 1; transform: translateX(0); }
1293-
}
1294-
@keyframes vt-slide-out-left {
1295-
from { opacity: 1; transform: translateX(0); }
1296-
to { opacity: 0; transform: translateX(-48px); }
1297-
}
1298-
@keyframes vt-slide-in-left {
1299-
from { opacity: 0; transform: translateX(-48px); }
1300-
to { opacity: 1; transform: translateX(0); }
1301-
}
1302-
@keyframes vt-slide-out-right {
1303-
from { opacity: 1; transform: translateX(0); }
1304-
to { opacity: 0; transform: translateX(48px); }
1305-
}
1306-
1307-
::view-transition-old(workshop-page) {
1308-
animation: 300ms cubic-bezier(0.4, 0, 1, 1) both vt-slide-out-left;
1309-
}
1310-
::view-transition-new(workshop-page) {
1311-
animation: 300ms cubic-bezier(0, 0, 0.2, 1) both vt-slide-in-right;
1312-
}
1313-
1314-
html[data-nav-backward] ::view-transition-old(workshop-page) {
1315-
animation: 300ms cubic-bezier(0.4, 0, 1, 1) both vt-slide-out-right;
1316-
}
1317-
html[data-nav-backward] ::view-transition-new(workshop-page) {
1318-
animation: 300ms cubic-bezier(0, 0, 0.2, 1) both vt-slide-in-left;
1319-
}
1320-
}

scripts/lib/page-template.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,6 @@ ${htmlContent}</main>
167167
const activePage = page ?? workshopPages[0];
168168
if (!activePage) return;
169169
170-
const currentPage = workshopPages.find(p => p.open);
171-
const currentIndex = currentPage ? workshopPages.indexOf(currentPage) : -1;
172-
const nextIndex = workshopPages.indexOf(activePage);
173-
const isBackward = currentIndex >= 0 && nextIndex >= 0 && currentIndex > nextIndex;
174-
document.documentElement.toggleAttribute('data-nav-backward', isBackward);
175-
176170
function applyPageChange() {
177171
workshopPages.forEach(candidate => {
178172
candidate.open = candidate === activePage;
@@ -188,11 +182,7 @@ ${htmlContent}</main>
188182
if (scrollPage) activePage.scrollIntoView({ block: 'start' });
189183
}
190184
191-
if (document.startViewTransition && currentPage && currentPage !== activePage) {
192-
document.startViewTransition(applyPageChange);
193-
} else {
194-
applyPageChange();
195-
}
185+
applyPageChange();
196186
}
197187
198188
function openDetailsAncestors(target) {

0 commit comments

Comments
 (0)