Improved breadcrumbs on auth host.

This commit is contained in:
Leo Vasanko
2025-12-10 18:20:37 +00:00
parent 2468fbd7fc
commit ccbe0f2f6f
+9 -3
View File
@@ -15,8 +15,14 @@ const props = defineProps({
const navRef = ref(null) const navRef = ref(null)
const crumbs = computed(() => { const crumbs = computed(() => {
const base = props.showHome ? [{ label: '🏠', href: props.homeHref }] : [] if (props.showHome && props.entries.length > 0 && props.entries[0].href === props.homeHref) {
return [...base, ...props.entries] // Combine home and first entry if they have the same href
const combined = { label: '🏠 ' + props.entries[0].label, href: props.homeHref }
return [combined, ...props.entries.slice(1)]
} else {
const base = props.showHome ? [{ label: '🏠', href: props.homeHref }] : []
return [...base, ...props.entries]
}
}) })
// Find the index of the crumb matching current location // Find the index of the crumb matching current location
@@ -70,7 +76,7 @@ defineExpose({ focusCurrent })
ref="navRef" ref="navRef"
class="breadcrumbs" class="breadcrumbs"
aria-label="Breadcrumb" aria-label="Breadcrumb"
v-if="crumbs.length" v-if="crumbs.length > 1"
tabindex="0" tabindex="0"
@focusin="handleFocusIn" @focusin="handleFocusIn"
@keydown="handleKeydown" @keydown="handleKeydown"