Skip to content

Commit fed4af5

Browse files
committed
feat(a11y): add accessible label to AppPopover
1 parent c5e939e commit fed4af5

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

app/components/AppPopover.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<script setup lang="ts">
22
const props = defineProps<{
3+
/** Accessible name for the dialog (required for a11y when popover is open) */
4+
label?: string
35
/** Position of the popover panel: 'top' | 'bottom' | 'left' | 'right' */
46
position?: 'top' | 'bottom' | 'left' | 'right'
57
}>()
@@ -63,6 +65,7 @@ onBeforeUnmount(clearCloseTimeout)
6365
v-if="isOpen"
6466
:id="popoverId"
6567
role="dialog"
68+
:aria-label="label"
6669
aria-modal="false"
6770
class="absolute font-mono text-xs text-fg bg-bg-subtle border border-border rounded-lg shadow-lg z-[100] pointer-events-auto px-4 py-3 min-w-[14rem] max-w-[22rem] whitespace-normal"
6871
:class="panelPosition"

app/pages/package/[...package].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ defineOgImageComponent('Package', {
497497

498498
<template v-if="hasProvenance(displayVersion) && provenanceBadgeMounted">
499499
<div class="relative inline-flex">
500-
<AppPopover position="bottom">
500+
<AppPopover :label="$t('package.verified_provenance')" position="bottom">
501501
<template #content>
502502
<p class="flex items-center gap-2 text-fg m-0">
503503
<span

test/nuxt/a11y.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ describe('component accessibility audits', () => {
233233

234234
it('should have no accessibility violations when open', async () => {
235235
const component = await mountSuspended(AppPopover, {
236+
props: { label: 'Popover' },
236237
slots: {
237238
default: '<button type="button">Trigger</button>',
238239
content: '<p>Popover content</p>',

0 commit comments

Comments
 (0)