Skip to content

Commit ea4142a

Browse files
committed
fix a11y lint error by making rows focusable and interactive
1 parent 3d1b37a commit ea4142a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/pages/system/AuditLog.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import cn from 'classnames'
1212
import { differenceInMilliseconds } from 'date-fns'
1313
import { memo, useCallback, useMemo, useRef, useState } from 'react'
1414
import { match } from 'ts-pattern'
15-
import { JsonValue } from 'type-fest'
15+
import { type JsonValue } from 'type-fest'
1616

1717
import { api } from '@oxide/api'
1818
import { Logs16Icon, Logs24Icon } from '@oxide/design-system/icons/react'
@@ -279,6 +279,15 @@ export default function SiloAuditLogsPage() {
279279
const newValue = isExpanded ? null : virtualRow.index.toString()
280280
handleToggle(newValue)
281281
}}
282+
// a11y thing: make it focusable and let the user press enter on it to toggle
283+
onKeyDown={(e) => {
284+
if (e.key === 'Enter' || e.key === ' ') {
285+
const newValue = isExpanded ? null : virtualRow.index.toString()
286+
handleToggle(newValue)
287+
}
288+
}}
289+
role="button" // oxlint-disable-line prefer-tag-over-role
290+
tabIndex={0}
282291
>
283292
{/* TODO: might be especially useful here to get the original UTC timestamp in a tooltip */}
284293
<div className="overflow-hidden whitespace-nowrap text-mono-sm">

0 commit comments

Comments
 (0)