Browser observation guide / Example @@ -31,5 +32,8 @@ browser.
From 504737300632d8644fbd6c658d2c97e38bb54c3b Mon Sep 17 00:00:00 2001 From: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com> Date: Wed, 7 Oct 2026 23:50:31 +0800 Subject: [PATCH] feat(website): add a shared back-to-top link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- website/README.md | 5 ++++ website/evidence/guide-examples.md | 4 +++ website/public/assets/main.js | 24 ++++++++++++++++ website/public/assets/styles.css | 29 ++++++++++++++++++++ website/public/examples/notes-web/index.html | 6 +++- website/public/get-started/index.html | 5 +++- website/public/guides/browser/index.html | 5 +++- website/public/guides/index.html | 5 +++- website/public/guides/javascript/index.html | 5 +++- website/public/guides/native/index.html | 5 +++- website/public/index.html | 5 +++- website/public/showcase/dx-ball/index.html | 5 +++- website/public/showcase/index.html | 5 +++- website/public/showcase/notion/index.html | 5 +++- website/public/showcase/th04/index.html | 5 +++- website/style-guide.md | 4 +++ 16 files changed, 111 insertions(+), 11 deletions(-) diff --git a/website/README.md b/website/README.md index b7f8bc668..abbce8908 100644 --- a/website/README.md +++ b/website/README.md @@ -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 diff --git a/website/evidence/guide-examples.md b/website/evidence/guide-examples.md index 70cdc859c..476c0fbd0 100644 --- a/website/evidence/guide-examples.md +++ b/website/evidence/guide-examples.md @@ -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` | diff --git a/website/public/assets/main.js b/website/public/assets/main.js index 40a1d9808..1cdb38e0e 100644 --- a/website/public/assets/main.js +++ b/website/public/assets/main.js @@ -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(); diff --git a/website/public/assets/styles.css b/website/public/assets/styles.css index d184cb31e..d1f36e0ee 100644 --- a/website/public/assets/styles.css +++ b/website/public/assets/styles.css @@ -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); } diff --git a/website/public/examples/notes-web/index.html b/website/public/examples/notes-web/index.html index 00d2c80b8..7f420d16d 100644 --- a/website/public/examples/notes-web/index.html +++ b/website/public/examples/notes-web/index.html @@ -7,8 +7,9 @@ + -
+