PronounsPage/components/SkipLink.vue

21 lines
574 B
Vue

<script setup lang="ts">
const router = useRouter();
router.afterEach(async (to, from) => {
if (to.path !== from.path) {
await nextTick();
// reset the focus to the start of the document
// so that the skip link is the first element in tab order after navigation
document.body.tabIndex = 0;
document.body.focus();
document.body.tabIndex = -1;
}
});
</script>
<template>
<a ref="link" href="#main" class="sr-only sr-only-focusable position-fixed top-0 z-1">
<T>home.skipToContent</T>
</a>
</template>