diff --git a/app/components/Package/ManagerSelect.vue b/app/components/Package/ManagerSelect.vue index 2f9e3d5dc..cbd442130 100644 --- a/app/components/Package/ManagerSelect.vue +++ b/app/components/Package/ManagerSelect.vue @@ -92,7 +92,7 @@ function handleKeydown(event: KeyboardEvent) { :aria-expanded="isOpen" aria-haspopup="listbox" :aria-label="$t('package.get_started.pm_label')" - :aria-controls="listboxId" + :aria-controls="isOpen ? listboxId : undefined" @click="toggle" @keydown="handleKeydown" > diff --git a/app/components/ReadmeTocDropdown.vue b/app/components/ReadmeTocDropdown.vue index 66f92d08e..95a0e0f41 100644 --- a/app/components/ReadmeTocDropdown.vue +++ b/app/components/ReadmeTocDropdown.vue @@ -148,7 +148,7 @@ function handleKeydown(event: KeyboardEvent) { :aria-expanded="isOpen" aria-haspopup="listbox" :aria-label="$t('package.readme.toc_title')" - :aria-controls="listboxId" + :aria-controls="isOpen ? listboxId : undefined" @click="toggle" @keydown="handleKeydown" classicon="i-lucide:list" @@ -180,7 +180,9 @@ function handleKeydown(event: KeyboardEvent) { ref="listRef" role="listbox" :aria-activedescendant=" - highlightedIndex >= 0 ? `${listboxId}-${toc[highlightedIndex]?.id}` : undefined + highlightedIndex >= 0 && toc[highlightedIndex]?.id + ? `${listboxId}-${toc[highlightedIndex]?.id}` + : undefined " :aria-label="$t('package.readme.toc_title')" :style="getDropdownStyle()" @@ -231,7 +233,7 @@ function handleKeydown(event: KeyboardEvent) { :aria-selected="activeId === grandchild.id" class="flex items-center gap-2 px-3 py-1.5 ps-9 text-sm cursor-pointer transition-colors duration-150" :class="[ - activeId === grandchild.id ? 'text-fg font-medium' : 'text-fg-subtle', + grandchild.id === activeId ? 'text-fg font-medium' : 'text-fg-subtle', highlightedIndex === getIndex(grandchild.id) ? 'bg-bg-elevated' : 'hover:bg-bg-elevated', diff --git a/nuxt.config.ts b/nuxt.config.ts index a51b06d6e..a5bb40714 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -248,7 +248,10 @@ export default defineNuxtConfig({ htmlValidator: { enabled: !isCI || (provider !== 'vercel' && !!process.env.VALIDATE_HTML), options: { - rules: { 'meta-refresh': 'off' }, + rules: { + 'meta-refresh': 'off', + 'prefer-native-element': ['error', { exclude: ['listbox'] }], + }, }, failOnError: true, },