fix(ui): [WIP] fix regression: use cursor keys for switching tabs

This commit is contained in:
upsiflu 2025-02-06 18:56:48 +01:00
parent b78d1f8992
commit 25a892dec0
1 changed files with 2 additions and 6 deletions

View File

@ -15,10 +15,6 @@ provide(TABS_INJECTION_KEY, {
tabs: tabs,
})
const currentTab = computed(() =>
tabs.find(({title}) => title === currentTitle.value)
)
const currentIndex = computed(() =>
tabs.findIndex(({title}) => title === currentTitle.value)
)
@ -37,8 +33,8 @@ watch(() => tabs.length, (_, from) => {
v-for="(tab, _) in tabs" :class="{ 'is-active': currentTitle === tab.title }"
v-bind="tab"
:onClick="() => { currentTitle = tab.title }"
@keydown.left="currentTitle = tabs[(currentIndex - 1 + tabs.length) % tabs.length]"
@keydown.right="currentTitle = tabs[(currentIndex + 1) % tabs.length]"
@keydown.left="currentTitle = tabs[(currentIndex - 1 + tabs.length) % tabs.length].title"
@keydown.right="currentTitle = tabs[(currentIndex + 1) % tabs.length].title"
class="tabs-item"
>
<div class="is-spacing">{{ tab.title }}</div>