Skip to content

Commit

Permalink
fix: target main content with skip link
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviareichl committed Sep 2, 2024
1 parent 59bb771 commit fe2e43c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/skip-link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ function onClick() {
const element = document.getElementById(props.targetId);
element?.focus();
}
const route = useRoute();
</script>

<template>
<NuxtLink
class="rounded fixed -translate-y-full bg-background px-4 py-3 text-foreground transition focus:translate-y-0"
:href="{ hash: `#${props.targetId}` }"
:href="{ query: route.query, hash: `#${props.targetId}` }"
@click="onClick"
>
<slot />
Expand Down

0 comments on commit fe2e43c

Please sign in to comment.