fix(ui): rows keep table semantics; first-cell link/button is the focus target (#1750)
Quality / check (push) Successful in 6m40s
deploy / gate (push) Successful in 4m59s
deploy / archied-image (push) Successful in 3m29s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped

DataTable, ActivityRow, LiveActivityCard's group row and CaptureRow no
longer put role=link/button, tabindex or aria-label on the <tr>. The row
keeps its mouse click handler; the first cell carries a real RouterLink
(DataTable rowLink) or button with the accessible name, so keyboard and
screen-reader users get a focus target and rows keep row/cell semantics.
The live-activity group row's disclosure button and open button are now
siblings, not nested.
This commit is contained in:
sam committed 2026-11-07 00:00:41 +11:00
1 parent ee2d19d011
commit ef623f6c68
4 files changed
+68 -58

No files matched your search

+10 -10
View File
@@ -40,18 +40,18 @@ function open(): void {
<template> <template>
<TableRow <TableRow
:data-state="isSelected ? 'selected' : undefined" :data-state="isSelected ? 'selected' : undefined"
role="button" class="cursor-pointer"
tabindex="0"
:aria-current="isSelected ? 'true' : undefined"
:aria-label="label"
class="cursor-pointer focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
@click="open" @click="open"
@keydown.enter.prevent="open"
@keydown.space.prevent="open"
> >
<TableCell class="font-mono">{{ <TableCell class="font-mono">
props.capture.source || "(unknown)" <button
}}</TableCell> type="button"
class="rounded-sm focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
:aria-label="label"
:aria-current="isSelected ? 'true' : undefined"
@click.stop="open"
>{{ props.capture.source || "(unknown)" }}</button>
</TableCell>
<TableCell><Timestamp :at="props.capture.received_at" /></TableCell> <TableCell><Timestamp :at="props.capture.received_at" /></TableCell>
<!-- An unidentified capture is never dispatched. --> <!-- An unidentified capture is never dispatched. -->
<TableCell> <TableCell>
+12 -6
View File
@@ -1,6 +1,6 @@
<script setup lang="ts" generic="Row"> <script setup lang="ts" generic="Row">
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { useRouter } from "vue-router"; import { RouterLink, useRouter } from "vue-router";
import { useLocalStorage } from "@vueuse/core"; import { useLocalStorage } from "@vueuse/core";
import { ArrowDown, ArrowUp, ArrowUpDown, Columns3 } from "@lucide/vue"; import { ArrowDown, ArrowUp, ArrowUpDown, Columns3 } from "@lucide/vue";
@@ -130,17 +130,23 @@ function open(row: Row): void {
<template v-for="row in sorted" :key="rowKey(row)"> <template v-for="row in sorted" :key="rowKey(row)">
<TableRow <TableRow
:data-row-key="rowKey(row)" :data-row-key="rowKey(row)"
:tabindex="rowLink || expandable ? 0 : undefined" :tabindex="expandable ? 0 : undefined"
:role="rowLink ? 'link' : undefined"
:aria-label="rowLink && rowLabel ? rowLabel(row) : undefined"
:aria-expanded="expandable ? expanded.has(rowKey(row)) : undefined" :aria-expanded="expandable ? expanded.has(rowKey(row)) : undefined"
:class="['align-top', (rowLink || expandable) && 'cursor-pointer', rowClass?.(row)]" :class="['align-top', (rowLink || expandable) && 'cursor-pointer', rowClass?.(row)]"
@click="open(row)" @click="open(row)"
@keydown.enter.self.prevent="open(row)" @keydown.enter.self.prevent="open(row)"
@keydown.space.self.prevent="open(row)" @keydown.space.self.prevent="open(row)"
> >
<TableCell v-for="column in shown" :key="column.id" :class="column.class"> <TableCell v-for="(column, cellIndex) in shown" :key="column.id" :class="column.class">
<slot :name="`cell-${column.id}`" :row="row" /> <RouterLink
v-if="cellIndex === 0 && rowLink"
:to="rowLink(row)"
:aria-label="rowLabel ? rowLabel(row) : undefined"
class="rounded-sm focus-visible:outline-2 focus-visible:outline-ring"
@click.stop
><slot :name="`cell-${column.id}`" :row="row"
/></RouterLink>
<slot v-else :name="`cell-${column.id}`" :row="row" />
</TableCell> </TableCell>
<TableCell v-if="trailing"><slot name="actions" :row="row" /></TableCell> <TableCell v-if="trailing"><slot name="actions" :row="row" /></TableCell>
</TableRow> </TableRow>
+10 -8
View File
@@ -36,16 +36,18 @@ function open() {
<template> <template>
<TableRow <TableRow
:class="taskID > 0 ? 'cursor-pointer' : ''" :class="taskID > 0 ? 'cursor-pointer' : ''"
:role="taskID > 0 ? 'link' : undefined"
:tabindex="taskID > 0 ? 0 : undefined"
:title="taskID > 0 ? 'Open task details' : undefined"
@click="open" @click="open"
@keydown.enter.prevent="open"
@keydown.space.prevent="open"
> >
<TableCell class="font-medium">{{ <TableCell class="font-medium">
describeTimelineEvent({ ...props.event, at: undefined, detail: undefined }).title <button
}}</TableCell> v-if="taskID > 0"
type="button"
class="rounded-sm text-left focus-visible:outline-2 focus-visible:outline-ring"
aria-label="Open task details"
@click.stop="open"
>{{ describeTimelineEvent({ ...props.event, at: undefined, detail: undefined }).title }}</button>
<template v-else>{{ describeTimelineEvent({ ...props.event, at: undefined, detail: undefined }).title }}</template>
</TableCell>
<TableCell class="font-mono">{{ <TableCell class="font-mono">{{
taskID > 0 ? `#${taskID}` : "–" taskID > 0 ? `#${taskID}` : "–"
}}</TableCell> }}</TableCell>
+36 -34
View File
@@ -163,46 +163,48 @@ function openTask(taskID: number) {
/> />
<template v-else> <template v-else>
<!-- <!--
The group row keeps ActivityRow's link contract: when its The row stays a row: mouse clicks open the task via the
events resolve to a task, the row itself opens the task, row handler, and the first cell holds the two real focus
with the same focusable role="link" behaviour. The targets -- the disclosure button and, when the group
disclosure button is a stop-propagated control inside the resolves to a task, an open button carrying its title.
first cell, so it never fights the row-level link.
--> -->
<TableRow <TableRow
:class="group.taskID > 0 ? 'cursor-pointer' : ''" :class="group.taskID > 0 ? 'cursor-pointer' : ''"
:role="group.taskID > 0 ? 'link' : undefined"
:tabindex="group.taskID > 0 ? 0 : undefined"
:title="
group.taskID > 0 ? 'Open task details' : undefined
"
@click="group.taskID > 0 && openTask(group.taskID)" @click="group.taskID > 0 && openTask(group.taskID)"
@keydown.enter.prevent="
group.taskID > 0 && openTask(group.taskID)
"
@keydown.space.prevent="
group.taskID > 0 && openTask(group.taskID)
"
> >
<TableCell class="font-medium"> <TableCell class="font-medium">
<button <div class="flex items-center gap-1">
type="button" <button
class="inline-flex items-center gap-1 rounded hover:opacity-80" type="button"
:aria-expanded="isOpen(group)" class="inline-flex items-center rounded hover:opacity-80 focus-visible:outline-2 focus-visible:outline-ring"
:aria-label="`${isOpen(group) ? 'Hide' : 'Show'} ${group.count} ${group.label} events`" :aria-expanded="isOpen(group)"
@click.stop="toggle(group.key)" :aria-label="`${isOpen(group) ? 'Hide' : 'Show'} ${group.count} ${group.label} events`"
> @click.stop="toggle(group.key)"
<ChevronDown >
v-if="isOpen(group)" <ChevronDown
class="size-3.5 shrink-0 text-fg-subtle" v-if="isOpen(group)"
/> class="size-3.5 shrink-0 text-fg-subtle"
<ChevronRight />
v-else <ChevronRight
class="size-3.5 shrink-0 text-fg-subtle" v-else
/> class="size-3.5 shrink-0 text-fg-subtle"
{{ describeTimelineEvent({ ...group.representative, at: undefined, detail: undefined }).title }} />
<Badge variant="idle">×{{ group.count }}</Badge> </button>
</button> <button
v-if="group.taskID > 0"
type="button"
class="inline-flex items-center gap-1 rounded hover:opacity-80 focus-visible:outline-2 focus-visible:outline-ring"
aria-label="Open task details"
@click.stop="openTask(group.taskID)"
>
{{ describeTimelineEvent({ ...group.representative, at: undefined, detail: undefined }).title }}
<Badge variant="idle">×{{ group.count }}</Badge>
</button>
<template v-else>
{{ describeTimelineEvent({ ...group.representative, at: undefined, detail: undefined }).title }}
<Badge variant="idle">×{{ group.count }}</Badge>
</template>
</div>
</TableCell> </TableCell>
<TableCell class="font-mono">{{ <TableCell class="font-mono">{{
group.taskID > 0 ? `#${group.taskID}` : "–" group.taskID > 0 ? `#${group.taskID}` : "–"