feat: integrate accessible journey world and controls

This commit is contained in:
2026-09-02 05:07:24 +03:00
parent fd8347fbdc
commit 190ac1ce62
10 changed files with 755 additions and 15 deletions

View File

@@ -1,20 +1,12 @@
<script setup lang="ts">
import { watch } from "vue";
import type { SectionId } from "@/content/types";
import { useJourneySections } from "@/composables/useJourneySections";
import { useKeyboardNavigation } from "@/composables/useKeyboardNavigation";
import type { JourneySnapshot } from '@/journey/types';
const props = defineProps<{
items: ReadonlyArray<{ id: SectionId; label: string }>;
journey: JourneySnapshot;
onSectionLinkClick: (event: MouseEvent) => void;
}>();
const canonicalIds = props.items.map((item) => item.id);
const navigation = useKeyboardNavigation(canonicalIds);
const journey = useJourneySections(canonicalIds, navigation.state);
watch(
() => journey.value.activeSectionId,
(id) => navigation.notePassiveSection(id),
);
</script>
<template>
@@ -24,9 +16,9 @@ watch(
<a
:href="`#${item.id}`"
:aria-current="
journey.activeSectionId === item.id ? 'page' : undefined
props.journey.activeSectionId === item.id ? 'page' : undefined
"
@click="navigation.onSectionLinkClick"
@click="props.onSectionLinkClick"
>{{ item.label }}</a
>
</li>