fix(ui): rows keep table semantics; first-cell link/button is the focus target (#1750)
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:
4 files changed
+68
-58
No files matched your search
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user