fix: add aria-current=page to active nav links

Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/10141#discussion_r2998394539
This commit is contained in:
bymyself
2026-03-26 21:01:04 -07:00
parent d59b8e0fc3
commit f5b68da4fb
2 changed files with 7 additions and 2 deletions

View File

@@ -102,10 +102,10 @@ const socials = [
<span
class="inline-block h-5 w-5 bg-current"
:style="{
maskImage: \`url(\${social.icon})\`,
maskImage: `url(${social.icon})`,
maskSize: 'contain',
maskRepeat: 'no-repeat',
WebkitMaskImage: \`url(\${social.icon})\`,
WebkitMaskImage: `url(${social.icon})`,
WebkitMaskSize: 'contain',
WebkitMaskRepeat: 'no-repeat'
}"

View File

@@ -2,6 +2,7 @@
import { onMounted, onUnmounted, ref } from 'vue'
const mobileMenuOpen = ref(false)
const currentPath = ref('')
const navLinks = [
{ label: 'ENTERPRISE', href: '/enterprise' },
@@ -31,11 +32,13 @@ function onKeydown(e: KeyboardEvent) {
function onAfterSwap() {
mobileMenuOpen.value = false
currentPath.value = window.location.pathname
}
onMounted(() => {
document.addEventListener('keydown', onKeydown)
document.addEventListener('astro:after-swap', onAfterSwap)
currentPath.value = window.location.pathname
})
onUnmounted(() => {
@@ -61,6 +64,7 @@ onUnmounted(() => {
v-for="link in navLinks"
:key="link.href"
:href="link.href"
:aria-current="currentPath === link.href ? 'page' : undefined"
class="text-sm font-medium tracking-wide text-white transition-colors hover:text-brand-yellow"
>
{{ link.label }}
@@ -117,6 +121,7 @@ onUnmounted(() => {
v-for="link in navLinks"
:key="link.href"
:href="link.href"
:aria-current="currentPath === link.href ? 'page' : undefined"
class="text-sm font-medium tracking-wide text-white transition-colors hover:text-brand-yellow"
@click="mobileMenuOpen = false"
>