Skip to content

Commit

Permalink
[website] updated to 1.34.0: keep focus on after navigation on clicke…
Browse files Browse the repository at this point in the history
…d page top tab
  • Loading branch information
msereniti committed Feb 23, 2024
1 parent 418a4c6 commit 0ee3807
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions website/docs/.vitepress/theme/PageTopTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>
<div class="page-top-tabs-container">
<div class="page-top-tabs-content">
<a class="page-top-tabs-tab" v-for="tab in tabs" :href="tab.url" :data-current="tab.current">{{ tab.title }}</a>
<a class="page-top-tabs-tab" v-for="tab in tabs" :href="tab.url" :data-current="tab.current" @click="handleClick">{{ tab.title }}</a>
</div>
<div class="page-top-tabs-fake-aside"></div>
</div>
Expand Down Expand Up @@ -104,9 +104,10 @@
</style>
<script setup>
import { computed } from 'vue'
import { useData, useRoute } from 'vitepress'
import { useData, useRoute, useRouter } from 'vitepress'
const { frontmatter } = useData();
const route = useRoute();
const router = useRouter();
const tabs = computed(() => (typeof frontmatter.value.tabs === 'string') ? frontmatter.value.tabs.split(',').map(tab => {
const urlLastPart = tab.substring(tab.lastIndexOf("('") + 2, tab.lastIndexOf("')")).trim()
const title = tab.substring(0, tab.indexOf("('")).trim()
Expand All @@ -115,4 +116,11 @@ const tabs = computed(() => (typeof frontmatter.value.tabs === 'string') ? front
return { url, title, current }
}) : []);
const title = computed(() => frontmatter.value.title);
async function handleClick(event) {
event.preventDefault();
await router.go(event.target.href);
event.target.focus()
}
</script>
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intergalactic-documentation",
"version": "1.33.15",
"version": "1.34.0",
"description": "",
"author": "",
"license": "MIT",
Expand Down

0 comments on commit 0ee3807

Please sign in to comment.