mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
Make alert metric edit cells keyboard-accessible
Each metric value cell on /alerts/thresholds is a clickable surface that
opens an inline editor for the threshold value. The wrapper was a plain
<div> with cursor-pointer and onClick — focusable for mouse but not for
keyboard, and screen readers didn't announce it as a button.
Add role="button", tabIndex={0}, onKeyDown for Enter/Space activation,
and an aria-label that mirrors the existing title hint. The mouse path
is unchanged; keyboard users can now Tab into the cells and press Enter
to open the editor.
This commit is contained in:
@@ -352,7 +352,7 @@ export function AlertResourceTableRow(props: AlertResourceTableRowProps) {
|
||||
);
|
||||
}
|
||||
|
||||
const openMetricEditor = (e: MouseEvent) => {
|
||||
const openMetricEditor = (e?: MouseEvent) => {
|
||||
startEditing(metric, e);
|
||||
};
|
||||
|
||||
@@ -366,9 +366,18 @@ export function AlertResourceTableRow(props: AlertResourceTableRowProps) {
|
||||
when={isEditing()}
|
||||
fallback={
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={openMetricEditor}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
event.preventDefault();
|
||||
openMetricEditor();
|
||||
}
|
||||
}}
|
||||
class="cursor-pointer hover:bg-surface-hover rounded px-1 py-0.5 transition-colors"
|
||||
title={getAlertResourceTableEditMetricTitle()}
|
||||
aria-label={getAlertResourceTableEditMetricTitle()}
|
||||
>
|
||||
<MetricValueWithHeat
|
||||
resourceId={props.resource.id}
|
||||
|
||||
Reference in New Issue
Block a user