Skip to content

Commit 39b1337

Browse files
committed
fix(ui): use aria-label instead of sr-only spans for icon-only buttons
sr-only spans made slots.default truthy, breaking auto-detection. aria-label is an equivalent accessible alternative that lets the slot be empty.
1 parent bb0cc7e commit 39b1337

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

app/components/Package/Dependencies.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,18 @@ const numberFormatter = useNumberFormatter()
150150
:to="packageRoute(dep, getVulnerableDepInfo(dep)!.version)"
151151
class="shrink-0"
152152
:class="SEVERITY_TEXT_COLORS[getHighestSeverity(getVulnerableDepInfo(dep)!.counts)]"
153+
:aria-label="$t('package.dependencies.view_vulnerabilities')"
153154
:title="`${getVulnerableDepInfo(dep)!.counts.total} vulnerabilities`"
154155
classicon="i-lucide:shield-check"
155-
>
156-
<span class="sr-only">{{ $t('package.dependencies.view_vulnerabilities') }}</span>
157-
</LinkBase>
156+
/>
158157
<LinkBase
159158
v-if="getDeprecatedDepInfo(dep)"
160159
:to="packageRoute(dep, getDeprecatedDepInfo(dep)!.version)"
161160
class="shrink-0 text-purple-700 dark:text-purple-500"
161+
:aria-label="$t('package.deprecated.label')"
162162
:title="getDeprecatedDepInfo(dep)!.message"
163163
classicon="i-lucide:octagon-alert"
164-
>
165-
<span class="sr-only">{{ $t('package.deprecated.label') }}</span>
166-
</LinkBase>
164+
/>
167165
<LinkBase
168166
:to="packageRoute(dep, version)"
169167
class="block truncate"

app/components/Package/Versions.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,11 @@ function majorGroupContainsCurrent(group: (typeof otherMajorGroups.value)[0]): b
476476
<ButtonBase
477477
variant="secondary"
478478
class="text-fg-subtle hover:text-fg transition-colors min-w-6 min-h-6 -m-1 p-1 rounded"
479+
:aria-label="$t('package.downloads.community_distribution')"
479480
:title="$t('package.downloads.community_distribution')"
480481
classicon="i-lucide:file-stack"
481482
@click="openDistributionModal"
482-
>
483-
<span class="sr-only">{{ $t('package.downloads.community_distribution') }}</span>
484-
</ButtonBase>
483+
/>
485484
</template>
486485
<div class="space-y-0.5 min-w-0">
487486
<!-- Semver range filter -->

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,10 @@ const config = computed(() => {
264264
type="button"
265265
@click="openChartModal"
266266
class="text-fg-subtle hover:text-fg transition-colors duration-200 inline-flex items-center justify-center min-w-6 min-h-6 -m-1 p-1 focus-visible:outline-accent/70 rounded"
267+
:aria-label="$t('package.trends.title')"
267268
:title="$t('package.trends.title')"
268269
classicon="i-lucide:chart-line"
269-
>
270-
<span class="sr-only">{{ $t('package.trends.title') }}</span>
271-
</ButtonBase>
270+
/>
272271
<span v-else-if="isLoadingWeeklyDownloads" class="min-w-6 min-h-6 -m-1 p-1" />
273272
</template>
274273

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,21 +1003,19 @@ const showSkeleton = shallowRef(false)
10031003
variant="button-secondary"
10041004
size="small"
10051005
:to="`https://npmgraph.js.org/?q=${pkg.name}`"
1006+
:aria-label="$t('package.stats.view_dependency_graph')"
10061007
:title="$t('package.stats.view_dependency_graph')"
10071008
classicon="i-lucide:network -rotate-90"
1008-
>
1009-
<span class="sr-only">{{ $t('package.stats.view_dependency_graph') }}</span>
1010-
</LinkBase>
1009+
/>
10111010

10121011
<LinkBase
10131012
variant="button-secondary"
10141013
size="small"
10151014
:to="`https://node-modules.dev/grid/depth#install=${pkg.name}${resolvedVersion ? `@${resolvedVersion}` : ''}`"
1015+
:aria-label="$t('package.stats.inspect_dependency_tree')"
10161016
:title="$t('package.stats.inspect_dependency_tree')"
10171017
classicon="i-lucide:table"
1018-
>
1019-
<span class="sr-only">{{ $t('package.stats.inspect_dependency_tree') }}</span>
1020-
</LinkBase>
1018+
/>
10211019
</ButtonGroup>
10221020
</dd>
10231021
</div>

0 commit comments

Comments
 (0)