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

+12 -6
View File
@@ -1,6 +1,6 @@
<script setup lang="ts" generic="Row">
import { computed, ref } from "vue";
import { useRouter } from "vue-router";
import { RouterLink, useRouter } from "vue-router";
import { useLocalStorage } from "@vueuse/core";
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)">
<TableRow
:data-row-key="rowKey(row)"
:tabindex="rowLink || expandable ? 0 : undefined"
:role="rowLink ? 'link' : undefined"
:aria-label="rowLink && rowLabel ? rowLabel(row) : undefined"
:tabindex="expandable ? 0 : undefined"
:aria-expanded="expandable ? expanded.has(rowKey(row)) : undefined"
:class="['align-top', (rowLink || expandable) && 'cursor-pointer', rowClass?.(row)]"
@click="open(row)"
@keydown.enter.self.prevent="open(row)"
@keydown.space.self.prevent="open(row)"
>
<TableCell v-for="column in shown" :key="column.id" :class="column.class">
<slot :name="`cell-${column.id}`" :row="row" />
<TableCell v-for="(column, cellIndex) in shown" :key="column.id" :class="column.class">
<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 v-if="trailing"><slot name="actions" :row="row" /></TableCell>
</TableRow>