Skip to content

Commit 880b091

Browse files
committed
feat: use tooltip for provenance badge
1 parent 1495782 commit 880b091

File tree

3 files changed

+21
-156
lines changed

3 files changed

+21
-156
lines changed

app/components/AppPopover.vue

Lines changed: 0 additions & 79 deletions
This file was deleted.

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

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -500,44 +500,27 @@ defineOgImageComponent('Package', {
500500
<span v-else>v{{ resolvedVersion }}</span>
501501

502502
<template v-if="hasProvenance(displayVersion) && provenanceBadgeMounted">
503-
<div class="relative inline-flex">
504-
<AppPopover :label="$t('package.verified_provenance')" position="bottom">
505-
<template #content>
506-
<p class="flex items-center gap-2 text-fg m-0">
507-
<span
508-
class="i-solar:shield-check-outline w-3.5 h-3.5 shrink-0 text-emerald-500"
509-
aria-hidden="true"
510-
/>
511-
<span>{{
512-
provenanceData && provenanceStatus !== 'pending'
513-
? $t('package.provenance_section.built_and_signed_on', {
514-
provider: provenanceData.providerLabel,
515-
})
516-
: $t('package.verified_provenance')
517-
}}</span>
518-
</p>
519-
<a href="#provenance" class="block mt-1.5 link font-medium">
520-
{{ $t('package.provenance_section.view_more_details') }}
521-
</a>
522-
</template>
523-
<template #default="{ popoverVisible, popoverId }">
524-
<a
525-
href="#provenance"
526-
:aria-label="$t('package.provenance_section.view_more_details')"
527-
:aria-expanded="popoverVisible"
528-
aria-haspopup="true"
529-
:aria-controls="popoverVisible ? popoverId : undefined"
530-
class="inline-flex items-center justify-center gap-1.5 text-fg-muted hover:text-emerald-500 transition-colors duration-200 min-w-6 min-h-6"
531-
:class="popoverVisible && 'text-emerald-500'"
532-
>
533-
<span
534-
class="i-solar:shield-check-outline w-3.5 h-3.5 shrink-0"
535-
aria-hidden="true"
536-
/>
537-
</a>
538-
</template>
539-
</AppPopover>
540-
</div>
503+
<TooltipApp
504+
:text="
505+
provenanceData && provenanceStatus !== 'pending'
506+
? $t('package.provenance_section.built_and_signed_on', {
507+
provider: provenanceData.providerLabel,
508+
})
509+
: $t('package.verified_provenance')
510+
"
511+
position="bottom"
512+
>
513+
<a
514+
href="#provenance"
515+
:aria-label="$t('package.provenance_section.view_more_details')"
516+
class="inline-flex items-center justify-center gap-1.5 text-fg-muted hover:text-emerald-500 transition-colors duration-200 min-w-6 min-h-6"
517+
>
518+
<span
519+
class="i-solar:shield-check-outline w-3.5 h-3.5 shrink-0"
520+
aria-hidden="true"
521+
/>
522+
</a>
523+
</TooltipApp>
541524
</template>
542525
<span
543526
v-if="requestedVersion && latestVersion && resolvedVersion !== latestVersion.version"

test/nuxt/a11y.spec.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ afterEach(() => {
6161
import {
6262
AppFooter,
6363
AppHeader,
64-
AppPopover,
6564
BaseCard,
6665
BuildEnvironment,
6766
CallToAction,
@@ -224,44 +223,6 @@ describe('component accessibility audits', () => {
224223
})
225224
})
226225

227-
describe('AppPopover', () => {
228-
it('should have no accessibility violations when closed', async () => {
229-
const component = await mountSuspended(AppPopover, {
230-
slots: {
231-
default: '<button type="button">Trigger</button>',
232-
content: '<p>Popover content</p>',
233-
},
234-
})
235-
const results = await runAxe(component)
236-
expect(results.violations).toEqual([])
237-
})
238-
239-
it('should have no accessibility violations when open', async () => {
240-
const component = await mountSuspended(AppPopover, {
241-
props: { label: 'Popover' },
242-
slots: {
243-
default: '<button type="button">Trigger</button>',
244-
content: '<p>Popover content</p>',
245-
},
246-
})
247-
await component.find('.relative').trigger('focusin')
248-
const results = await runAxe(component)
249-
expect(results.violations).toEqual([])
250-
})
251-
252-
it('should have no accessibility violations with position prop', async () => {
253-
const component = await mountSuspended(AppPopover, {
254-
props: { position: 'top' },
255-
slots: {
256-
default: '<button type="button">Trigger</button>',
257-
content: '<p>Popover content</p>',
258-
},
259-
})
260-
const results = await runAxe(component)
261-
expect(results.violations).toEqual([])
262-
})
263-
})
264-
265226
describe('BaseCard', () => {
266227
it('should have no accessibility violations', async () => {
267228
const component = await mountSuspended(BaseCard, {

0 commit comments

Comments
 (0)