Skip to content

Commit

Permalink
πŸ› arrow key で tab γ‚’η§»ε‹•γ—γŸιš›γ« focus γ‚‚η§»ε‹•γ•γ›γ‚‹γ‚ˆγ†γ«
Browse files Browse the repository at this point in the history
  • Loading branch information
SSlime-s committed Aug 21, 2023
1 parent c283b77 commit bf32277
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import useBoxSize from '/@/composables/dom/useBoxSize'
import useRelatedChannels from '/@/composables/useRelatedChannels'
import { randomString } from '/@/lib/basic/randomString'
import ATab from '/@/components/UI/ATab.vue'
import type { Ref } from 'vue'
interface Props {
rightPosition: Point
Expand Down Expand Up @@ -93,6 +94,13 @@ const formattedSiblings = computed(() =>
)
const tabNames = ['siblings', 'children'] as const
const tabNameRefs: Record<
(typeof tabNames)[number],
Ref<InstanceType<typeof ATab> | null>
> = {
siblings: siblingTab,
children: childrenTab
}
const currentTab = ref<(typeof tabNames)[number]>('siblings')
const onKeydown = (e: KeyboardEvent) => {
const index = tabNames.indexOf(currentTab.value)
Expand All @@ -110,6 +118,7 @@ const onKeydown = (e: KeyboardEvent) => {
nextIndex = (nextIndex + tabNames.length) % tabNames.length
currentTab.value = tabNames[nextIndex] ?? currentTab.value
tabNameRefs[currentTab.value].value?.focus()
}
const emit = defineEmits<{
Expand Down

0 comments on commit bf32277

Please sign in to comment.