fix(ui): scale touch targets to the pointer, not the window width

A coarse-pointer-only floor keeps switches, tab triggers and scrolled nav
strips from being deformed on a phone, and the topbar reveals the current
section after a route change.
This commit is contained in:
sam committed 2026-10-18 12:32:10 +11:00
1 parent 42c283c4fd
commit b4395046ae
5 files changed
+26 -8

No files matched your search

+13 -1
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed } from "vue";
import { computed, onMounted, watch } from "vue";
import { useRoute } from "vue-router";
import { activeNavPath, navTree, type NavEntry } from "@/lib/nav";
@@ -11,6 +11,18 @@ const links = computed(() =>
navTree(props.hidden).flatMap((node): NavEntry[] => (node.kind === "link" ? [node.entry] : [])),
);
const activePath = computed(() => activeNavPath(route.path));
// The strip scrolls sideways on a narrow window, so the current section can sit
// outside it. Centre it after each route change; block:"nearest" keeps it from
// scrolling the page too.
function revealActive(): void {
document
.querySelector('nav[aria-label="Sections"] [aria-current="page"]')
?.scrollIntoView({ inline: "center", block: "nearest" });
}
onMounted(revealActive);
watch(activePath, revealActive, { flush: "post" });
</script>
<template>