feat(website): add a shared back-to-top link
Long guides and case studies now have a small `↑ Top` link at the bottom right. It appears after scrolling, returns smoothly to the page header, and moves keyboard focus back to navigation. Reduced-motion users return immediately; the native `#top` link also works without JavaScript. The link is shared by all 11 styled website pages. The README and style guide document it, and the evidence notes retain the original browser-example digest alongside its later navigation addition. Validation: - Website preparation and verification: 12 HTML pages, 195 local references, SVG XML, the six-file ZIP and the sole manual Pages publisher. - Oxfmt, `git diff --check` and `npm run check:fast` with Node.js 24.18.0. - Focused browser checks at `/` and `/rea/`: 22 routes, 21 pointer returns, six keyboard returns, five viewport widths, smooth scrolling, reduced motion, focus return and the no-JavaScript anchor. - Existing site interactions: 24 routes, 68 copy buttons, 20 comparison steps, two CSV exports, two ZIP downloads and eight viewport widths from 320px to 1440px. Code excerpts are unchanged. - Desktop and mobile rendering reviewed. Downloadable Electron source and CSV export source/data are unchanged. Publication continues through the existing manual Pages workflow after merge.
This commit is contained in:
@@ -64,6 +64,11 @@ respecting reduced-motion preferences. Both the prompt and animation work
|
||||
without JavaScript. The homepage and agent setup section share a copyable
|
||||
installation prompt; setup still presents its plan for approval.
|
||||
|
||||
Reading pages share a small `↑ Top` link at the bottom right. It appears after
|
||||
scrolling and returns to the page header, with smooth scrolling when reduced
|
||||
motion is disabled. Keyboard activation returns focus to the first navigation
|
||||
link. Without JavaScript, the link stays visible and uses its `#top` anchor.
|
||||
|
||||
DX-Ball figures and findings refer to the linked 7 October 2026 checkpoint,
|
||||
commit `a55dca27ec0a07018c1b2c95ae2be027f7d8c3c4`. Update those links and figures
|
||||
together when moving to another checkpoint. Case-study source excerpts come
|
||||
|
||||
@@ -71,6 +71,10 @@ Full local outputs and the browser verification harness are under
|
||||
|
||||
## Example source digests
|
||||
|
||||
These digests identify the files used for the recorded analyses. The browser
|
||||
page later gained the site's shared `↑ Top` navigation; its `export.js` and
|
||||
`notes.json` retain the versions below.
|
||||
|
||||
| File | SHA-256 |
|
||||
| -------------------------------------- | ------------------------------------------------------------------ |
|
||||
| `examples/notes-electron/csv.js` | `6875aeecc1d3e6c1ff5b888a199c26b377d812d5b10e5fb4025e192a206b0018` |
|
||||
|
||||
@@ -60,3 +60,27 @@ function initializeStepComparisons() {
|
||||
}
|
||||
|
||||
initializeStepComparisons();
|
||||
|
||||
function initializeBackToTop() {
|
||||
const link = document.querySelector(".back-to-top");
|
||||
if (link === null) return;
|
||||
|
||||
const updateVisibility = () => {
|
||||
link.hidden = window.scrollY < 400;
|
||||
};
|
||||
window.addEventListener("scroll", updateVisibility, { passive: true });
|
||||
updateVisibility();
|
||||
|
||||
link.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
const reduceMotion = window.matchMedia(
|
||||
"(prefers-reduced-motion: reduce)",
|
||||
).matches;
|
||||
window.scrollTo({ top: 0, behavior: reduceMotion ? "auto" : "smooth" });
|
||||
document
|
||||
.querySelector(".brand, .breadcrumb a")
|
||||
?.focus({ preventScroll: true });
|
||||
});
|
||||
}
|
||||
|
||||
initializeBackToTop();
|
||||
|
||||
@@ -99,6 +99,31 @@ section[id] {
|
||||
.skip-link:focus {
|
||||
top: 0.75rem;
|
||||
}
|
||||
.back-to-top {
|
||||
position: fixed;
|
||||
right: calc(1.5rem + env(safe-area-inset-right, 0px));
|
||||
bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
|
||||
z-index: 5;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
min-height: 44px;
|
||||
padding: 0.5rem 0.85rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 6px;
|
||||
background: var(--page);
|
||||
color: var(--muted);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
}
|
||||
.back-to-top[hidden] {
|
||||
display: none;
|
||||
}
|
||||
.back-to-top:hover {
|
||||
background: var(--soft);
|
||||
color: var(--ink);
|
||||
}
|
||||
.site-header {
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
@@ -1023,6 +1048,10 @@ pre code {
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.back-to-top {
|
||||
right: calc(1rem + env(safe-area-inset-right, 0px));
|
||||
bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
.container {
|
||||
width: calc(100% - 2.5rem);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
<link rel="icon" href="../../assets/favicon.svg" type="image/svg+xml" />
|
||||
<link rel="stylesheet" href="../../assets/styles.css" />
|
||||
<script src="export.js" defer></script>
|
||||
<script src="../../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<main class="container example-app">
|
||||
<p class="breadcrumb">
|
||||
<a href="../../guides/browser/">Browser observation guide</a> / Example
|
||||
@@ -31,5 +32,8 @@
|
||||
browser.
|
||||
</p>
|
||||
</main>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../assets/styles.css" />
|
||||
<script src="../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -399,5 +399,8 @@ npx rea-agents@latest setup</code></pre>
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../../assets/styles.css" />
|
||||
<script src="../../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -334,5 +334,8 @@ link.click();</code></pre>
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../assets/styles.css" />
|
||||
<script src="../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -117,5 +117,8 @@
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../../assets/styles.css" />
|
||||
<script src="../../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -330,5 +330,8 @@
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../../assets/styles.css" />
|
||||
<script src="../../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -266,5 +266,8 @@ return (DxBallInt)pan;</code></pre>
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="assets/styles.css" />
|
||||
<script src="assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -289,5 +289,8 @@
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../../assets/styles.css" />
|
||||
<script src="../../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -620,5 +620,8 @@
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../assets/styles.css" />
|
||||
<script src="../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -116,5 +116,8 @@
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../../assets/styles.css" />
|
||||
<script src="../../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -458,5 +458,8 @@ mimeTypes:
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<link rel="stylesheet" href="../../assets/styles.css" />
|
||||
<script src="../../assets/main.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body id="top">
|
||||
<a class="skip-link" href="#main">Skip to content</a>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
@@ -635,5 +635,8 @@ no_aim:
|
||||
</div>
|
||||
</footer>
|
||||
<p class="sr-only" id="copy-status" role="status" aria-live="polite"></p>
|
||||
<a class="back-to-top" href="#top" aria-label="Back to top">
|
||||
<span aria-hidden="true">↑</span> Top
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -154,6 +154,10 @@ cursor animation and reduced-motion behavior. Label an example prompt as an
|
||||
example; a real recorded result belongs in an evidence block. Copy buttons
|
||||
should copy only the intended text, without the prompt symbol or cursor.
|
||||
|
||||
Include the shared `↑ Top` link on reading pages, with `id="top"` on the body.
|
||||
Keep its 44px minimum touch height, safe-area spacing and keyboard focus return.
|
||||
Use the shared script for visibility and reduced-motion behavior.
|
||||
|
||||
Use `minmax(0, 1fr)` for grid tracks that contain long commands or nested panels.
|
||||
Allow code blocks to scroll within their own area. Check expanded details as
|
||||
well as the default page. Document-level horizontal scrolling usually means a
|
||||
|
||||
Reference in New Issue
Block a user