aboutsummaryrefslogtreecommitdiffstats
path: root/web/index.html
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-30 19:26:54 +0200
committeruser <user@clank>2026-08-30 19:26:54 +0200
commite7555078282054ed9c02579b37e0d628db599b92 (patch)
tree835daaafd6b896d0781b3534791c5245ef87c4d9 /web/index.html
parentweb: the tour's doorway steps stop grabbing (diff)
downloadslosh-e7555078282054ed9c02579b37e0d628db599b92.tar.gz
slosh-e7555078282054ed9c02579b37e0d628db599b92.tar.xz
slosh-e7555078282054ed9c02579b37e0d628db599b92.zip
web: the whole step is the road, not just its title
Clicking anywhere in a dimmed article glides it to the centre and so, through the observer, switches the recording. Three guards keep the click meaning navigation: the active step does not react (clicks there are for reading and selecting, not going where you already are), a selection is not a click, and a link is a link. The pointer cursor and the title's breath of pink now belong to dimmed steps only -- the active one is just prose.
Diffstat (limited to 'web/index.html')
-rw-r--r--web/index.html21
1 files changed, 12 insertions, 9 deletions
diff --git a/web/index.html b/web/index.html
index fa59404..1a6c6b4 100644
--- a/web/index.html
+++ b/web/index.html
@@ -460,16 +460,19 @@ if (tour) {
const ctl = (el) => el._sloshcast;
let current = null; // the first activation always plays
- // A step's title is a road to the step: clicking it glides the article to
- // the middle of the viewport, which is the exact spot where the observer
- // below activates it -- so the click also switches the recording, through
- // the same door scrolling uses.
+ // A step is a road to itself: clicking anywhere in a dimmed article
+ // glides it to the middle of the viewport, the exact spot where the
+ // observer below activates it -- so the click also switches the
+ // recording, through the same door scrolling uses. The active step does
+ // not react: clicks there are for reading and selecting, not going where
+ // you already are. A selection is not a click, and a link is a link.
for (const s of steps) {
- const h = s.querySelector("h3");
- if (h)
- h.addEventListener("click", () =>
- s.scrollIntoView({ block: "center" })
- );
+ s.addEventListener("click", (ev) => {
+ if (s.classList.contains("active")) return;
+ if (ev.target.closest("a")) return;
+ if (!getSelection().isCollapsed) return;
+ s.scrollIntoView({ block: "center" });
+ });
}
const show = (name) => {