Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions apps/frontend/src/components/ui/NavTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,20 @@ function computeActiveIndex(): { index: number; isSubpage: boolean } {
}

function getTabElement(index: number): HTMLElement | null {
if (!tabLinkElements.value?.[index]) return null
if (index === -1) return null

// In navigation mode, elements are NuxtLinks with $el property
// In local mode, elements are plain divs
const element = tabLinkElements.value[index]
return props.mode === 'navigation' ? (element as any).$el : element
const container = scrollContainer.value as HTMLElement | undefined
if (!container) return null

const tabs = container.querySelectorAll('.button-animation')
const element = tabs[index] as HTMLElement | undefined

if (!element) return null

// In navigation mode, elements are NuxtLinks, but since we used querySelectorAll,
// we already have the raw HTMLElement ($el), so no further conversion is needed.
// In local mode, elements are already plain divs.
return element
}

function positionSlider() {
Expand Down Expand Up @@ -253,7 +261,8 @@ function animateSliderTo(newPosition: {
sliderBottom.value = newPosition.bottom
}

function updateActiveTab() {
async function updateActiveTab() {
await nextTick()
const { index, isSubpage } = computeActiveIndex()
currentActiveIndex.value = index
subpageSelected.value = isSubpage
Expand Down