Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(frontend): add shared summary row action controls

rcourtmane279c2a5f9e4
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 18e43ebf33..a28b895131 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -132,6 +132,7 @@ work extends shared components instead of creating new local variants.
110. `frontend-modern/src/components/shared/SummaryScopeBar.tsx`
111. `frontend-modern/src/components/shared/summaryScopePresentation.ts`
112. `frontend-modern/src/components/shared/summaryInteractionA11y.ts`
+113. `frontend-modern/src/components/shared/SummaryRowActionButton.tsx`
## Shared Boundaries
@@ -153,14 +154,17 @@ work extends shared components instead of creating new local variants.
9. Keep page summaries page-scoped when table rows enter contextual focus. Route-backed row selection may add a focused label and shared series emphasis, but infrastructure, workloads, and storage summary cards must continue to render the page-level series set instead of collapsing the summary down to the selected row or replacing the global trend view with row-local empty states.
10. Keep contextual row focus on the shared summary primitive. Summary surfaces and same-route table drill-ins must reuse `frontend-modern/src/components/shared/contextualFocus.ts` for interactive-series filtering, focused-name lookup, active-series derivation, local scroll preservation, and deliberate inline-detail reveal instead of rebuilding page-local `Set` filters, focused-label scans, drawer-aware scroll math, or ad hoc scroll restoration in each surface.
11. Keep summary-to-table coordination deliberate, explicit, and reversible. Shared summary hover may highlight the matching table row when it is already visible, but transient chart hover must not auto-filter tables, auto-scroll the page, or reshuffle table ordering. When a page/group/entity scope is active on workloads, infrastructure, or storage, the page shell must surface that state through the shared `frontend-modern/src/components/shared/SummaryScopeBar.tsx` plus `frontend-modern/src/components/shared/summaryScopePresentation.ts` contract instead of inventing page-local chips, breadcrumbs, or hidden route-only focus. That shared scope bar must distinguish transient preview from pinned focus, keep the current scope visible even when the sticky summary is collapsed or off-screen, and expose a clear reset path for pinned scope so touch-only operators do not depend on hover or “click the same row again” discovery. When the active row is off-screen, page owners must still route through `frontend-modern/src/components/shared/summaryTableFocus.ts` and surface a lightweight `Jump to row` affordance that reveals and scrolls only on explicit user action. Deliberate row focus may reveal inline detail automatically, but that reveal must be drawer-aware: preserve already-good positions, avoid hard centering, and scroll only enough to keep the row header plus the top of the inline detail visible.
- Shared summary-linked rows and group headers must also route their pointer,
- focus, and keyboard semantics through
- `frontend-modern/src/components/shared/summaryInteractionA11y.ts` so fine
- pointers get transient preview, focusable rows preview on keyboard
- navigation, `Enter`/`Space` trigger the same deliberate pin or row-toggle
- action as click, `Escape` clears preview without mutating pinned route
- state, and touch surfaces do not inherit fake mouse-hover behavior through
- page-local event handlers.
+ Shared summary-linked rows and group headers must also route their preview
+ semantics through
+ `frontend-modern/src/components/shared/summaryInteractionA11y.ts` and
+ route deliberate pin/open ownership through
+ `frontend-modern/src/components/shared/SummaryRowActionButton.tsx`.
+ Fine pointers may preview from the row, but `aria-expanded`,
+ `aria-controls`, `aria-pressed`, focus treatment, and `Escape` preview
+ clearing belong to the shared leading action control rather than
+ focusable-table-row shims. Workloads, infrastructure, and storage must not
+ rebuild row-as-button keyboard handling or trailing one-off expand columns
+ once the shared action primitive exists.
12. Keep summary-linked table row emphasis on the shared primitive contract. Workloads, infrastructure, and storage rows that mirror the active summary entity must expose that state through `data-summary-row-active` and let the shared presentation in `frontend-modern/src/index.css` render the row emphasis, rather than carrying page-local sky or blue fill classes inside each row renderer.
13. Keep retained-value data loading honest at the ownership boundary. Helpers
that prevent a feature surface from falling through the app-level Suspense
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 0a3d0a9c51..a63936ab10 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -169,10 +169,11 @@ regression protection.
27. Keep summary hover/focus and sticky-card behavior on shared hot paths: infrastructure, workloads, and storage summary shells must reuse one page/group/entity scope model plus `frontend-modern/src/components/shared/StickySummarySection.tsx` inside the app scroll shell instead of per-page scroll listeners or per-card hover derivations, so row scrubbing highlights all cards, workload group headers, infrastructure cluster headers, and storage pool-group headers scope the summary coherently, pinned group focus remains route-backed and reversible, and the hot path does not multiply render or scroll work. The explicit scope affordance for that hot path must also stay shared: `frontend-modern/src/components/shared/SummaryScopeBar.tsx` and `frontend-modern/src/components/shared/summaryScopePresentation.ts` own the visible page/group/entity scope label, preview-vs-pinned distinction, and reset affordance so touch-safe reversibility does not fork per-page banner logic. That same hot path must keep chart-backed summary-card geometry explicit and stable so hover rerenders, synchronized readouts, idle header metadata, or the scope bar itself cannot feed layout loops that grow or shrink the top cards over time. Recovery’s summary rail is not part of this interactive hot path; it may share summary-card framing, but it must remain non-interactive until a separately governed model says otherwise.
The input path for that hot summary contract must stay shared too:
`frontend-modern/src/components/shared/summaryInteractionA11y.ts` owns
- fine-pointer preview, focus-preview continuity, and `Enter`/`Space`
- deliberate activation for summary-linked rows and group headers, so
+ fine-pointer preview and focus-preview continuity, while
+ `frontend-modern/src/components/shared/SummaryRowActionButton.tsx` owns
+ deliberate open/pin controls for summary-linked rows and group headers, so
workloads, infrastructure, and storage do not rebuild mouse-only hover
- branches, keyboard-only toggles, or touch-hostile synthetic hover behavior
+ branches, focusable-row toggles, or touch-hostile synthetic hover behavior
inside individual row renderers.
28. Keep summary-card hover emphasis on one bounded rendering budget: when a summary row is active, shared sparkline and density-map primitives must promote the selected series and demote background series through the same active-series ID rather than layering a second page-local highlight pass, so zoom-range and hover scrubbing stay visually coherent without reintroducing multi-series overdraw on the hot summary cards. Density maps on that hot path must stay overview-first under focus: preserve the multi-entity heatmap rows, layer focused-entity detail inside the card, and avoid swapping transient hover into a separate single-series chart path.
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 7d6692ffc2..c0ebd62c31 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -219,11 +219,13 @@ querying, and the operator-facing storage health presentation layer.
rather than carrying storage-local sky fill classes that drift from the
rest of the product or obscure inline capacity bars. Storage pool rows,
physical-disk rows, and storage group headers must also route pointer,
- focus, and keyboard preview/toggle behavior through
- `frontend-modern/src/components/shared/summaryInteractionA11y.ts` so touch
- users do not inherit synthetic hover branches and keyboard users can pin or
- clear scope through the same shared row interaction contract as mouse
- users.
+ and focus preview through
+ `frontend-modern/src/components/shared/summaryInteractionA11y.ts`, while
+ deliberate expand/pin ownership must route through
+ `frontend-modern/src/components/shared/SummaryRowActionButton.tsx`, so
+ touch users do not inherit synthetic hover branches and storage does not
+ keep a special trailing expand column once the shared leading action
+ contract exists.
17. Keep recovery transport refreshes inside the recovery-owned feature state.
`frontend-modern/src/features/recovery/useRecoverySurfaceState.ts` and the
recovery data hooks may retain the last fulfilled rollups, points, facets,
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index f21c61f1f8..5e9cfb9135 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -224,11 +224,13 @@ assembly branch.
`frontend-modern/src/index.css` instead of provider-specific background
classes that drift across resource tables or hide inline metric bars.
Summary-linked infrastructure rows and cluster headers must also route
- pointer preview, focus preview, and keyboard activation through
- `frontend-modern/src/components/shared/summaryInteractionA11y.ts` so the
- unified-resource table does not fork mouse-only hover logic, touch-hostile
- synthetic hover, or provider-specific key handling across host, PBS, and
- PMG sections.
+ pointer preview and focus preview through
+ `frontend-modern/src/components/shared/summaryInteractionA11y.ts`, while
+ deliberate expand/scope ownership must route through
+ `frontend-modern/src/components/shared/SummaryRowActionButton.tsx`, so the
+ unified-resource table does not fork mouse-only hover logic, focusable-row
+ button shims, touch-hostile synthetic hover, or provider-specific control
+ handling across host, PBS, and PMG sections.
15. Keep infrastructure search aligned with the governed display label. Shared
infrastructure filtering through
`frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts`
diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx
index d07ed44bf9..086447348a 100644
--- a/frontend-modern/src/components/Dashboard/GuestRow.tsx
+++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx
@@ -19,9 +19,10 @@ import { resolveWorkloadType } from '@/utils/workloads';
import { EnhancedCPUBar } from '@/components/Dashboard/EnhancedCPUBar';
import { UpdateButton } from '@/components/shared/ContainerUpdateBadge';
import {
- createSummaryInteractiveRowHandlers,
- SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS,
+ buildSummaryDisclosureControlsId,
+ createSummaryInteractiveRowPreviewHandlers,
} from '@/components/shared/summaryInteractionA11y';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
import { getDashboardGuestDiskStatusMessage } from '@/utils/dashboardGuestPresentation';
import type { GuestRowProps } from './guestRowModel';
import { useGuestRowState } from './useGuestRowState';
@@ -86,6 +87,7 @@ export function GuestRow(props: GuestRowProps) {
} = useGuestRowState(props);
const cpuPercent = createMemo(() => (props.guest.cpu || 0) * 100);
+ const detailControlsId = createMemo(() => buildSummaryDisclosureControlsId(guestId()));
const getDiskStatusTooltip = () => {
if (!isVM(props.guest)) return 'Disk stats unavailable';
@@ -95,17 +97,16 @@ export function GuestRow(props: GuestRowProps) {
};
const interactiveRowHandlers =
props.onClick || props.onHoverChange
- ? createSummaryInteractiveRowHandlers({
+ ? createSummaryInteractiveRowPreviewHandlers({
onPreview: () => props.onHoverChange?.(guestId()),
onPreviewClear: () => props.onHoverChange?.(null),
- onToggle: props.onClick,
})
: {};
return (
<>
<tr
- class={`${rowClass()} ${props.onClick ? 'cursor-pointer group' : ''} ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ class={`${rowClass()} ${props.onClick ? 'cursor-pointer group' : ''}`.trim()}
style={rowStyle()}
data-guest-id={guestId()}
data-summary-series-id={guestId()}
@@ -118,21 +119,16 @@ export function GuestRow(props: GuestRowProps) {
class={`pr-1.5 sm:pr-2 py-0.5 align-middle whitespace-nowrap ${firstCellIndent()}`}
>
<div class="flex items-center gap-2 min-w-0">
- <div class={`transition-transform duration-200 ${props.isExpanded ? 'rotate-90' : ''}`}>
- <svg
- class="w-3.5 h-3.5 text-muted group-hover:text-base-content"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M9 5l7 7-7 7"
- />
- </svg>
- </div>
+ <Show when={props.onClick}>
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel={props.guest.name}
+ expanded={props.isExpanded}
+ controlsId={detailControlsId()}
+ onAction={() => props.onClick?.()}
+ onPreviewClear={() => props.onHoverChange?.(null)}
+ />
+ </Show>
<div class="flex items-center gap-1.5 min-w-0">
<StatusDot
variant={guestStatus().variant}
diff --git a/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx b/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
index c2f86a85f5..a9b0b6c966 100644
--- a/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
+++ b/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
@@ -3,9 +3,10 @@ import { createMemo, Index, Show } from 'solid-js';
import { ComponentErrorBoundary } from '@/components/ErrorBoundary';
import { NodeGroupHeader } from '@/components/shared/NodeGroupHeader';
import {
- createSummaryInteractiveRowHandlers,
- SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS,
+ createSummaryInteractiveRowPreviewHandlers,
} from '@/components/shared/summaryInteractionA11y';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
+import { buildSummaryDisclosureControlsId } from '@/components/shared/summaryInteractionA11y';
import { TableBody, TableCell, TableRow } from '@/components/shared/Table';
import { getAlertStyles } from '@/utils/alerts';
import { isNodeOnline } from '@/utils/status';
@@ -87,10 +88,9 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
scope && props.focusedSummaryWorkloadGroupId() === scope.id ? null : scope,
);
};
- const groupRowInteraction = createSummaryInteractiveRowHandlers({
+ const groupRowInteraction = createSummaryInteractiveRowPreviewHandlers({
onPreview: () => handleGroupHoverChange(groupSummaryScope()),
onPreviewClear: () => handleGroupHoverChange(null),
- onToggle: handleGroupFocusToggle,
});
return (
@@ -100,11 +100,10 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
when={node()}
fallback={
<TableRow
- class={`bg-surface-alt transition-colors duration-150 hover:bg-surface-hover ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ class="bg-surface-alt transition-colors duration-150 hover:bg-surface-hover"
data-summary-group-id={groupKey()}
data-summary-group-series-count={String(groupSummaryScope()?.seriesIds.length ?? 0)}
data-summary-row-active={isSummaryGroupHighlighted() ? 'true' : 'false'}
- aria-pressed={props.focusedSummaryWorkloadGroupId() === groupSummaryScope()?.id}
onClick={handleGroupFocusToggle}
{...groupRowInteraction}
>
@@ -116,6 +115,13 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
const label = props.getGroupLabel(groupKey(), fullGroupGuests());
return (
<div class="flex items-center gap-3">
+ <SummaryRowActionButton
+ kind="scope"
+ subjectLabel={label.name}
+ pressed={props.focusedSummaryWorkloadGroupId() === groupSummaryScope()?.id}
+ onAction={handleGroupFocusToggle}
+ onPreviewClear={() => handleGroupHoverChange(null)}
+ />
<span>{label.name}</span>
<Show when={label.type}>
<span class="inline-flex items-center rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300">
@@ -133,14 +139,22 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
node={node()!}
renderAs="tr"
colspan={props.totalColumns()}
- trClass={`transition-colors duration-150 hover:bg-surface-hover ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ leadingAction={
+ <SummaryRowActionButton
+ kind="scope"
+ subjectLabel={props.getGroupLabel(groupKey(), fullGroupGuests()).name}
+ pressed={props.focusedSummaryWorkloadGroupId() === groupSummaryScope()?.id}
+ onAction={handleGroupFocusToggle}
+ onPreviewClear={() => handleGroupHoverChange(null)}
+ />
+ }
+ trClass="transition-colors duration-150 hover:bg-surface-hover"
trProps={{
'data-summary-group-id': groupKey(),
'data-summary-group-series-count': String(
groupSummaryScope()?.seriesIds.length ?? 0,
),
'data-summary-row-active': isSummaryGroupHighlighted() ? 'true' : 'false',
- 'aria-pressed': props.focusedSummaryWorkloadGroupId() === groupSummaryScope()?.id,
onClick: handleGroupFocusToggle,
...groupRowInteraction,
}}
@@ -150,6 +164,9 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
<Index each={groupGuests()} fallback={<></>}>
{(guest) => {
const guestId = createMemo(() => getCanonicalWorkloadId(guest()));
+ const detailControlsId = createMemo(() =>
+ buildSummaryDisclosureControlsId(guestId()),
+ );
const metadata = () =>
props.guestMetadata()[guestId()] ||
props.guestMetadata()[`${guest().instance}:${guest().node}:${guest().vmid}`];
@@ -188,6 +205,7 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
<Show when={props.selectedGuestId() === guestId()}>
<TableRow data-inline-detail-for={guestId()}>
<TableCell
+ id={detailControlsId()}
colspan={props.totalColumns()}
class="p-0 border-b border-border bg-surface-alt"
>
diff --git a/frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx
index 2180469424..764ffd354c 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx
+++ b/frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx
@@ -465,21 +465,23 @@ describe('GuestRow', () => {
expect(onHoverChange).toHaveBeenCalledWith(null);
});
- it('toggles the row from keyboard when the row itself is focused', () => {
+ it('toggles the row from the shared disclosure button keyboard path', () => {
const onClick = vi.fn();
const onHoverChange = vi.fn();
- const { container } = renderGuestRow({
- guest: makeGuest(),
+ const guest = makeGuest();
+ renderGuestRow({
+ guest,
onClick,
onHoverChange,
});
- const tr = container.querySelector('tr')!;
- expect(tr).toHaveAttribute('tabindex', '0');
+ const toggleButton = screen.getByRole('button', {
+ name: `Expand ${guest.name}`,
+ });
- fireEvent.focusIn(tr);
+ fireEvent.focusIn(toggleButton);
expect(onHoverChange).toHaveBeenCalled();
- fireEvent.keyDown(tr, { key: 'Enter' });
+ fireEvent.click(toggleButton);
expect(onClick).toHaveBeenCalledOnce();
});
});
@@ -692,6 +694,7 @@ describe('GuestRow', () => {
const { container } = renderGuestRow({
guest: makeGuest(),
isExpanded: true,
+ onClick: vi.fn(),
});
const chevronWrapper = container.querySelector('.rotate-90');
expect(chevronWrapper).toBeTruthy();
@@ -701,6 +704,7 @@ describe('GuestRow', () => {
const { container } = renderGuestRow({
guest: makeGuest(),
isExpanded: false,
+ onClick: vi.fn(),
});
const chevronWrapper = container.querySelector('.rotate-90');
expect(chevronWrapper).toBeNull();
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
index 684690ae2d..4408560898 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
@@ -34,9 +34,10 @@ import { ClusterDeployBanner } from './ClusterDeployBanner';
import { ResourceFacetSummary } from './ResourceFacetSummary';
import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import {
- createSummaryInteractiveRowHandlers,
- SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS,
+ buildSummaryDisclosureControlsId,
+ createSummaryInteractiveRowPreviewHandlers,
} from '@/components/shared/summaryInteractionA11y';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
import {
type UnifiedResourceTableProps,
type UnifiedResourceTableState,
@@ -165,20 +166,18 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
nextScope && tableProps.focusedSummaryGroupId === nextScope.id ? null : nextScope?.id ?? null,
);
};
- const groupRowInteraction = createSummaryInteractiveRowHandlers({
+ const groupRowInteraction = createSummaryInteractiveRowPreviewHandlers({
onPreview: () => handleGroupHoverChange(groupSummaryScope()),
onPreviewClear: () => handleGroupHoverChange(null),
- onToggle: handleGroupFocusToggle,
});
return (
<TableRow
- class={`bg-surface-alt transition-colors duration-150 hover:bg-surface-hover ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ class="bg-surface-alt transition-colors duration-150 hover:bg-surface-hover"
data-summary-group-id={groupSummaryScope()?.id ?? undefined}
data-summary-group-series-count={String(
groupSummaryScope()?.seriesIds.length ?? 0,
)}
data-summary-row-active={isSummaryGroupHighlighted() ? 'true' : 'false'}
- aria-pressed={tableProps.focusedSummaryGroupId === groupSummaryScope()?.id}
onClick={handleGroupFocusToggle}
{...groupRowInteraction}
>
@@ -187,6 +186,15 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
class="py-1 pr-2 pl-4 text-[12px] sm:text-sm font-semibold text-base-content"
>
<div class="flex items-center gap-2">
+ <SummaryRowActionButton
+ kind="scope"
+ subjectLabel={group.cluster || 'Standalone'}
+ pressed={
+ tableProps.focusedSummaryGroupId === groupSummaryScope()?.id
+ }
+ onAction={handleGroupFocusToggle}
+ onPreviewClear={() => handleGroupHoverChange(null)}
+ />
<Show
when={group.cluster}
fallback={<span class="text-muted">Standalone</span>}
@@ -226,6 +234,9 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
getAgentStatusIndicator({ status: resource.status }),
);
const metricsKey = createMemo(() => buildMetricKeyForUnifiedResource(resource));
+ const detailControlsId = createMemo(() =>
+ buildSummaryDisclosureControlsId(resource.id),
+ );
const cpuPercentValue = createMemo(() =>
resource.cpu ? Math.round(getCpuPercent(resource)) : null,
@@ -294,10 +305,9 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
getResourcePolicyTableBadges(resource.policy),
);
const workloadsHref = createMemo(() => buildWorkloadsHref(resource));
- const resourceRowInteraction = createSummaryInteractiveRowHandlers({
+ const resourceRowInteraction = createSummaryInteractiveRowPreviewHandlers({
onPreview: () => tableProps.onHoverChange?.(resource.id),
onPreviewClear: () => tableProps.onHoverChange?.(null),
- onToggle: () => table.toggleExpand(resource.id),
});
return (
@@ -311,30 +321,21 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
? 'true'
: 'false'
}
- class={`${rowClass()} ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ class={rowClass()}
style={{ 'min-height': '32px' }}
onClick={() => table.toggleExpand(resource.id)}
{...resourceRowInteraction}
>
<TableCell class="pr-1.5 sm:pr-2 py-0.5 align-middle overflow-hidden pl-2 sm:pl-3">
<div class="flex items-center gap-1.5 min-w-0">
- <div
- class={`shrink-0 transition-transform duration-200 ${isExpanded() ? 'rotate-90' : ''}`}
- >
- <svg
- class="w-3.5 h-3.5 text-muted group-hover:text-base-content"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M9 5l7 7-7 7"
- />
- </svg>
- </div>
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel={displayName()}
+ expanded={isExpanded()}
+ controlsId={detailControlsId()}
+ onAction={() => table.toggleExpand(resource.id)}
+ onPreviewClear={() => tableProps.onHoverChange?.(null)}
+ />
<StatusDot
variant={statusIndicator().variant}
title={statusIndicator().label}
@@ -640,6 +641,7 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
<Show when={isExpanded()}>
<TableRow data-inline-detail-for={resource.id}>
<TableCell
+ id={detailControlsId()}
colspan={9}
class="bg-surface-alt px-4 py-4 border-b border-border-subtle shadow-inner"
>
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx
index 983affbc5c..96bc3e2afa 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx
@@ -3,9 +3,10 @@ import type { Component } from 'solid-js';
import { formatUptime } from '@/utils/format';
import { StatusDot } from '@/components/shared/StatusDot';
import {
- createSummaryInteractiveRowHandlers,
- SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS,
+ buildSummaryDisclosureControlsId,
+ createSummaryInteractiveRowPreviewHandlers,
} from '@/components/shared/summaryInteractionA11y';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
import {
Table,
TableBody,
@@ -132,10 +133,12 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSe
return className;
});
- const resourceRowInteraction = createSummaryInteractiveRowHandlers({
+ const detailControlsId = createMemo(() =>
+ buildSummaryDisclosureControlsId(resource.id),
+ );
+ const resourceRowInteraction = createSummaryInteractiveRowPreviewHandlers({
onPreview: () => tableProps.onHoverChange?.(resource.id),
onPreviewClear: () => tableProps.onHoverChange?.(null),
- onToggle: () => table.toggleExpand(resource.id),
});
return (
@@ -148,30 +151,21 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSe
? 'true'
: 'false'
}
- class={`${rowClass()} ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ class={rowClass()}
style={{ 'min-height': '32px' }}
onClick={() => table.toggleExpand(resource.id)}
{...resourceRowInteraction}
>
<TableCell class="pr-1.5 sm:pr-2 py-0.5 align-middle overflow-hidden pl-2 sm:pl-3">
<div class="flex items-center gap-1.5 min-w-0">
- <div
- class={`shrink-0 transition-transform duration-200 ${isExpanded() ? 'rotate-90' : ''}`}
- >
- <svg
- class="w-3.5 h-3.5 text-muted group-hover:text-base-content"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M9 5l7 7-7 7"
- />
- </svg>
- </div>
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel={displayName()}
+ expanded={isExpanded()}
+ controlsId={detailControlsId()}
+ onAction={() => table.toggleExpand(resource.id)}
+ onPreviewClear={() => tableProps.onHoverChange?.(null)}
+ />
<StatusDot
variant={statusIndicator().variant}
title={statusIndicator().label}
@@ -303,6 +297,7 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSe
<Show when={isExpanded()}>
<TableRow data-inline-detail-for={resource.id}>
<TableCell
+ id={detailControlsId()}
colspan={7}
class="bg-surface-alt px-4 py-4 border-b border-border-subtle shadow-inner"
>
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx
index 258691c7a4..4e77e53a15 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx
@@ -3,9 +3,10 @@ import type { Component } from 'solid-js';
import { formatUptime } from '@/utils/format';
import { StatusDot } from '@/components/shared/StatusDot';
import {
- createSummaryInteractiveRowHandlers,
- SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS,
+ buildSummaryDisclosureControlsId,
+ createSummaryInteractiveRowPreviewHandlers,
} from '@/components/shared/summaryInteractionA11y';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
import {
Table,
TableBody,
@@ -149,10 +150,12 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSe
return className;
});
- const resourceRowInteraction = createSummaryInteractiveRowHandlers({
+ const detailControlsId = createMemo(() =>
+ buildSummaryDisclosureControlsId(resource.id),
+ );
+ const resourceRowInteraction = createSummaryInteractiveRowPreviewHandlers({
onPreview: () => tableProps.onHoverChange?.(resource.id),
onPreviewClear: () => tableProps.onHoverChange?.(null),
- onToggle: () => table.toggleExpand(resource.id),
});
return (
@@ -165,30 +168,21 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSe
? 'true'
: 'false'
}
- class={`${rowClass()} ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ class={rowClass()}
style={{ 'min-height': '32px' }}
onClick={() => table.toggleExpand(resource.id)}
{...resourceRowInteraction}
>
<TableCell class="pr-1.5 sm:pr-2 py-0.5 align-middle overflow-hidden pl-2 sm:pl-3">
<div class="flex items-center gap-1.5 min-w-0">
- <div
- class={`shrink-0 transition-transform duration-200 ${isExpanded() ? 'rotate-90' : ''}`}
- >
- <svg
- class="w-3.5 h-3.5 text-muted group-hover:text-base-content"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M9 5l7 7-7 7"
- />
- </svg>
- </div>
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel={displayName()}
+ expanded={isExpanded()}
+ controlsId={detailControlsId()}
+ onAction={() => table.toggleExpand(resource.id)}
+ onPreviewClear={() => tableProps.onHoverChange?.(null)}
+ />
<StatusDot
variant={statusIndicator().variant}
title={statusIndicator().label}
@@ -342,6 +336,7 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSe
<Show when={isExpanded()}>
<TableRow data-inline-detail-for={resource.id}>
<TableCell
+ id={detailControlsId()}
colspan={9}
class="bg-surface-alt px-4 py-4 border-b border-border-subtle shadow-inner"
>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
index 0906b856b7..4272ba1fb8 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
@@ -18,6 +18,7 @@ import infrastructureSummaryModelSource from '@/components/Infrastructure/infras
import unifiedResourceHostTableCardSource from '@/components/Infrastructure/UnifiedResourceHostTableCard.tsx?raw';
import unifiedResourcePBSTableSectionSource from '@/components/Infrastructure/UnifiedResourcePBSTableSection.tsx?raw';
import unifiedResourcePMGTableSectionSource from '@/components/Infrastructure/UnifiedResourcePMGTableSection.tsx?raw';
+import summaryRowActionButtonSource from '@/components/shared/SummaryRowActionButton.tsx?raw';
import summaryInteractionA11ySource from '@/components/shared/summaryInteractionA11y.ts?raw';
import resourceDetailMappersSource from '@/components/Infrastructure/resourceDetailMappers.ts?raw';
import resourceDetailDiscoveryModelSource from '@/components/Infrastructure/resourceDetailDiscoveryModel.ts?raw';
@@ -273,8 +274,12 @@ describe('UnifiedResourceTable performance contract', () => {
expect(frontendIndexCssSource).toContain("tr[data-summary-row-active='true'] > td");
expect(frontendIndexCssSource).toContain('--color-summary-row-bg');
expect(frontendIndexCssSource).toContain('--color-summary-row-accent');
- expect(summaryInteractionA11ySource).toContain('createSummaryInteractiveRowHandlers');
- expect(summaryInteractionA11ySource).toContain('SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS');
+ expect(summaryInteractionA11ySource).toContain('createSummaryInteractiveRowPreviewHandlers');
+ expect(summaryInteractionA11ySource).toContain('createSummaryInteractiveActionKeydownHandler');
+ expect(summaryRowActionButtonSource).toContain('SummaryRowActionButton');
+ expect(summaryRowActionButtonSource).toContain('aria-controls');
+ expect(summaryRowActionButtonSource).toContain('aria-expanded');
+ expect(summaryRowActionButtonSource).toContain('aria-pressed');
for (const source of [
unifiedResourceHostTableCardSource,
@@ -282,8 +287,8 @@ describe('UnifiedResourceTable performance contract', () => {
unifiedResourcePMGTableSectionSource,
]) {
expect(source).toContain('data-summary-row-active');
- expect(source).toContain('createSummaryInteractiveRowHandlers');
- expect(source).toContain('SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS');
+ expect(source).toContain('createSummaryInteractiveRowPreviewHandlers');
+ expect(source).toContain('SummaryRowActionButton');
expect(source).not.toContain('bg-blue-50 dark:bg-blue-900 ring-1 ring-blue-300');
expect(source).not.toContain('bg-blue-100 dark:bg-blue-800');
}
diff --git a/frontend-modern/src/components/Storage/DiskList.tsx b/frontend-modern/src/components/Storage/DiskList.tsx
index e952230629..cac9c074d6 100644
--- a/frontend-modern/src/components/Storage/DiskList.tsx
+++ b/frontend-modern/src/components/Storage/DiskList.tsx
@@ -1,9 +1,10 @@
import { Component, For, Show } from 'solid-js';
import { Card } from '@/components/shared/Card';
import {
- createSummaryInteractiveRowHandlers,
- SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS,
+ buildSummaryDisclosureControlsId,
+ createSummaryInteractiveRowPreviewHandlers,
} from '@/components/shared/summaryInteractionA11y';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
import { resolvePhysicalDiskMetricResourceId } from '@/features/storageBackups/storageMetricsIdentity';
import {
Table,
@@ -17,7 +18,6 @@ import { formatBytes } from '@/utils/format';
import { formatTemperature, getTemperatureTextClass } from '@/utils/temperature';
import {
PHYSICAL_DISK_CELL_DISK_CLASS,
- PHYSICAL_DISK_CELL_EXPAND_CLASS,
PHYSICAL_DISK_CELL_HEALTH_CLASS,
PHYSICAL_DISK_CELL_HOST_CLASS,
PHYSICAL_DISK_CELL_PARENT_CLASS,
@@ -35,9 +35,7 @@ import {
PHYSICAL_DISK_EMPTY_REQUIREMENTS_NOTE_CLASS,
PHYSICAL_DISK_EMPTY_REQUIREMENTS_TITLE_CLASS,
PHYSICAL_DISK_EMPTY_TITLE_CLASS,
- PHYSICAL_DISK_EXPAND_BUTTON_CLASS,
PHYSICAL_DISK_HEADER_DISK_CLASS,
- PHYSICAL_DISK_HEADER_EXPAND_CLASS,
PHYSICAL_DISK_HEADER_HEALTH_CLASS,
PHYSICAL_DISK_HEADER_HOST_CLASS,
PHYSICAL_DISK_HEADER_PARENT_CLASS,
@@ -63,7 +61,6 @@ import {
PHYSICAL_DISK_TABLE_ROW_STYLE,
PHYSICAL_DISK_TABLE_SCROLL_CLASS,
getPhysicalDiskEmptyStatePresentation,
- getPhysicalDiskExpandIconClass,
getPhysicalDiskHealthStatus,
getPhysicalDiskHealthSummary,
getPhysicalDiskHostLabel,
@@ -160,7 +157,6 @@ export const DiskList: Component<DiskListProps> = (props) => {
<TableHead class={PHYSICAL_DISK_HEADER_HEALTH_CLASS}>Health</TableHead>
<TableHead class={PHYSICAL_DISK_HEADER_TEMP_CLASS}>Temp</TableHead>
<TableHead class={PHYSICAL_DISK_HEADER_SIZE_CLASS}>Size</TableHead>
- <TableHead class={PHYSICAL_DISK_HEADER_EXPAND_CLASS} />
</TableRow>
</TableHeader>
<TableBody class={PHYSICAL_DISK_TABLE_BODY_CLASS}>
@@ -175,10 +171,10 @@ export const DiskList: Component<DiskListProps> = (props) => {
const summarySeriesId = resolvePhysicalDiskMetricResourceId(disk);
const isSummaryHighlighted = () =>
props.highlightedSummarySeriesId === summarySeriesId;
- const interactiveRowHandlers = createSummaryInteractiveRowHandlers({
+ const detailControlsId = buildSummaryDisclosureControlsId(summarySeriesId);
+ const interactiveRowHandlers = createSummaryInteractiveRowPreviewHandlers({
onPreview: () => props.onHoverChange?.(disk.id),
onPreviewClear: () => props.onHoverChange?.(null),
- onToggle: () => model.toggleSelectedDisk(disk),
});
return (
@@ -193,13 +189,21 @@ export const DiskList: Component<DiskListProps> = (props) => {
isSelected()
? PHYSICAL_DISK_TABLE_ROW_SELECTED_CLASS
: PHYSICAL_DISK_TABLE_ROW_HOVER_CLASS
- } ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ }`.trim()}
style={PHYSICAL_DISK_TABLE_ROW_STYLE}
onClick={() => model.toggleSelectedDisk(disk)}
{...interactiveRowHandlers}
>
<TableCell class={PHYSICAL_DISK_CELL_DISK_CLASS}>
<div class={PHYSICAL_DISK_NAME_WRAP_CLASS}>
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel={data.model || 'disk'}
+ expanded={isSelected()}
+ controlsId={detailControlsId}
+ onAction={() => model.toggleSelectedDisk(disk)}
+ onPreviewClear={() => props.onHoverChange?.(null)}
+ />
<span
class={PHYSICAL_DISK_NAME_TEXT_CLASS}
title={data.devPath || data.model || disk.name || 'Unknown Disk'}
@@ -288,35 +292,14 @@ export const DiskList: Component<DiskListProps> = (props) => {
</span>
</TableCell>
- <TableCell class={PHYSICAL_DISK_CELL_EXPAND_CLASS}>
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- model.toggleSelectedDisk(disk);
- }}
- class={PHYSICAL_DISK_EXPAND_BUTTON_CLASS}
- aria-label={`Toggle details for ${data.model || 'disk'}`}
- >
- <svg
- class={getPhysicalDiskExpandIconClass(isSelected())}
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M9 5l7 7-7 7"
- />
- </svg>
- </button>
- </TableCell>
</TableRow>
<Show when={isSelected()}>
<TableRow data-inline-detail-for={summarySeriesId}>
- <TableCell colSpan={9} class={PHYSICAL_DISK_DETAIL_ROW_CELL_CLASS}>
+ <TableCell
+ id={detailControlsId}
+ colSpan={8}
+ class={PHYSICAL_DISK_DETAIL_ROW_CELL_CLASS}
+ >
<DiskDetail disk={disk} nodes={props.nodes} />
</TableCell>
</TableRow>
diff --git a/frontend-modern/src/components/Storage/StorageGroupRow.tsx b/frontend-modern/src/components/Storage/StorageGroupRow.tsx
index 7841224db4..c47961b09e 100644
--- a/frontend-modern/src/components/Storage/StorageGroupRow.tsx
+++ b/frontend-modern/src/components/Storage/StorageGroupRow.tsx
@@ -3,9 +3,9 @@ import { EnhancedStorageBar } from './EnhancedStorageBar';
import type { StorageGroupedRecords, StorageGroupKey } from './useStorageModel';
import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import {
- createSummaryInteractiveRowHandlers,
- SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS,
+ createSummaryInteractiveRowPreviewHandlers,
} from '@/components/shared/summaryInteractionA11y';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
import {
buildStorageGroupRowPresentation,
STORAGE_GROUP_ROW_CELL_CLASS,
@@ -19,7 +19,6 @@ import {
STORAGE_GROUP_ROW_POOL_COUNT_CLASS,
STORAGE_GROUP_ROW_USAGE_LABEL_CLASS,
STORAGE_GROUP_ROW_USAGE_WRAP_CLASS,
- getStorageGroupChevronClass,
} from '@/features/storageBackups/groupPresentation';
interface StorageGroupRowProps {
@@ -36,19 +35,17 @@ interface StorageGroupRowProps {
export const StorageGroupRow: Component<StorageGroupRowProps> = (props) => {
const row = () => buildStorageGroupRowPresentation(props.group);
- const interactiveRowHandlers = createSummaryInteractiveRowHandlers({
+ const interactiveRowHandlers = createSummaryInteractiveRowPreviewHandlers({
onPreview: () => props.onHoverChange?.(props.summaryGroupScope),
onPreviewClear: () => props.onHoverChange?.(null),
- onToggle: () => props.onFocusChange?.(props.summaryFocused ? null : props.summaryGroupScope),
});
return (
<tr
- class={`${STORAGE_GROUP_ROW_CLASS} ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ class={STORAGE_GROUP_ROW_CLASS}
data-summary-group-id={props.summaryGroupScope?.id ?? undefined}
data-summary-group-series-count={String(props.summaryGroupScope?.seriesIds.length ?? 0)}
data-summary-row-active={props.summaryActive ? 'true' : 'false'}
- aria-pressed={props.summaryFocused}
onClick={() =>
props.onFocusChange?.(
props.summaryFocused ? null : props.summaryGroupScope,
@@ -58,27 +55,23 @@ export const StorageGroupRow: Component<StorageGroupRowProps> = (props) => {
>
<td colSpan={99} class={STORAGE_GROUP_ROW_CELL_CLASS}>
<div class={STORAGE_GROUP_ROW_CONTENT_CLASS}>
- <button
- type="button"
- aria-label={props.expanded ? `Collapse ${row().label}` : `Expand ${row().label}`}
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel={row().label}
+ expanded={props.expanded}
+ onAction={props.onToggle}
+ onPreviewClear={() => props.onHoverChange?.(null)}
class="inline-flex items-center justify-center"
- onClick={(event) => {
- event.stopPropagation();
- props.onToggle();
- }}
- >
- <svg
- class={getStorageGroupChevronClass(props.expanded)}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2.5"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <path d="M9 18l6-6-6-6" />
- </svg>
- </button>
+ />
+ <SummaryRowActionButton
+ kind="scope"
+ subjectLabel={row().label}
+ pressed={props.summaryFocused}
+ onAction={() =>
+ props.onFocusChange?.(props.summaryFocused ? null : props.summaryGroupScope)
+ }
+ onPreviewClear={() => props.onHoverChange?.(null)}
+ />
{/* Group label */}
<span class={STORAGE_GROUP_ROW_LABEL_CLASS}>
diff --git a/frontend-modern/src/components/Storage/StoragePoolDetail.tsx b/frontend-modern/src/components/Storage/StoragePoolDetail.tsx
index 08541120f4..0243342292 100644
--- a/frontend-modern/src/components/Storage/StoragePoolDetail.tsx
+++ b/frontend-modern/src/components/Storage/StoragePoolDetail.tsx
@@ -38,6 +38,7 @@ interface StoragePoolDetailProps {
record: StorageRecord;
physicalDisks: Resource[];
summarySeriesId: string;
+ controlsId?: string;
}
export const StoragePoolDetail: Component<StoragePoolDetailProps> = (props) => {
@@ -49,7 +50,7 @@ export const StoragePoolDetail: Component<StoragePoolDetailProps> = (props) => {
return (
<tr class={STORAGE_DETAIL_ROW_CLASS} data-inline-detail-for={props.summarySeriesId}>
- <td colSpan={99} class={STORAGE_DETAIL_CELL_CLASS}>
+ <td id={props.controlsId} colSpan={99} class={STORAGE_DETAIL_CELL_CLASS}>
<div class={STORAGE_DETAIL_ROOT_GRID_CLASS}>
{/* Left: Capacity trend chart */}
<div class={STORAGE_DETAIL_CARD_CLASS}>
diff --git a/frontend-modern/src/components/Storage/StoragePoolRow.tsx b/frontend-modern/src/components/Storage/StoragePoolRow.tsx
index cd799621a2..4a962e567a 100644
--- a/frontend-modern/src/components/Storage/StoragePoolRow.tsx
+++ b/frontend-modern/src/components/Storage/StoragePoolRow.tsx
@@ -6,12 +6,9 @@ import {
} from '@/features/storageBackups/rowPresentation';
import {
buildStoragePoolRowModel,
- getStoragePoolExpandIconClass,
getStoragePoolImpactTextClass,
STORAGE_POOL_ROW_CLASS,
STORAGE_POOL_ROW_EXPANDED_CLASS,
- STORAGE_POOL_ROW_EXPAND_BUTTON_CLASS,
- STORAGE_POOL_ROW_EXPAND_CELL_CLASS,
STORAGE_POOL_ROW_PLACEHOLDER_CLASS,
STORAGE_POOL_ROW_HOST_CELL_CLASS,
STORAGE_POOL_ROW_IMPACT_CELL_CLASS,
@@ -35,9 +32,10 @@ import type { Resource } from '@/types/resource';
import { EnhancedStorageBar } from './EnhancedStorageBar';
import { StoragePoolDetail } from './StoragePoolDetail';
import {
- createSummaryInteractiveRowHandlers,
- SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS,
+ buildSummaryDisclosureControlsId,
+ createSummaryInteractiveRowPreviewHandlers,
} from '@/components/shared/summaryInteractionA11y';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
interface StoragePoolRowProps {
record: StorageRecord;
@@ -59,16 +57,18 @@ interface StoragePoolRowProps {
export const StoragePoolRow: Component<StoragePoolRowProps> = (props) => {
const row = createMemo(() => buildStoragePoolRowModel(props.record));
- const interactiveRowHandlers = createSummaryInteractiveRowHandlers({
+ const detailControlsId = createMemo(() =>
+ buildSummaryDisclosureControlsId(props.summarySeriesId),
+ );
+ const interactiveRowHandlers = createSummaryInteractiveRowPreviewHandlers({
onPreview: () => props.onHoverChange?.(props.summarySeriesId),
onPreviewClear: () => props.onHoverChange?.(null),
- onToggle: props.onToggleExpand,
});
return (
<>
<tr
- class={`${STORAGE_POOL_ROW_CLASS} ${props.rowClass} ${props.expanded ? STORAGE_POOL_ROW_EXPANDED_CLASS : ''} ${SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS}`.trim()}
+ class={`${STORAGE_POOL_ROW_CLASS} ${props.rowClass} ${props.expanded ? STORAGE_POOL_ROW_EXPANDED_CLASS : ''}`.trim()}
style={{ ...props.rowStyle, ...STORAGE_POOL_ROW_STYLE }}
onClick={props.onToggleExpand}
{...interactiveRowHandlers}
@@ -77,9 +77,19 @@ export const StoragePoolRow: Component<StoragePoolRowProps> = (props) => {
{...props.alertDataAttrs}
>
<td class={STORAGE_POOL_ROW_NAME_CELL_CLASS}>
- <span class={STORAGE_POOL_ROW_NAME_TEXT_CLASS} title={props.record.name}>
- {props.record.name}
- </span>
+ <div class="flex min-w-0 items-center gap-1.5">
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel={props.record.name}
+ expanded={props.expanded}
+ controlsId={detailControlsId()}
+ onAction={props.onToggleExpand}
+ onPreviewClear={() => props.onHoverChange?.(null)}
+ />
+ <span class={STORAGE_POOL_ROW_NAME_TEXT_CLASS} title={props.record.name}>
+ {props.record.name}
+ </span>
+ </div>
</td>
<td class={STORAGE_POOL_ROW_SOURCE_CELL_CLASS}>
@@ -154,36 +164,13 @@ export const StoragePoolRow: Component<StoragePoolRowProps> = (props) => {
</span>
</Show>
</td>
-
- <td class={STORAGE_POOL_ROW_EXPAND_CELL_CLASS}>
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- props.onToggleExpand();
- }}
- class={STORAGE_POOL_ROW_EXPAND_BUTTON_CLASS}
- aria-label={`Toggle details for ${props.record.name}`}
- >
- <svg
- class={getStoragePoolExpandIconClass(props.expanded)}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <path d="M9 18l6-6-6-6" />
- </svg>
- </button>
- </td>
</tr>
<Show when={props.expanded}>
<StoragePoolDetail
record={props.record}
physicalDisks={props.physicalDisks}
summarySeriesId={props.summarySeriesId}
+ controlsId={detailControlsId()}
/>
</Show>
</>
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index 51a777099e..8e35e9a219 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -766,18 +766,23 @@ describe('Storage', () => {
return;
}
- fireEvent.click(groupRow);
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Pin summary scope for pve1' }),
+ );
await waitFor(() => {
expect(navigateSpy).toHaveBeenCalledWith(
'/storage?group=node&summaryGroup=storage%3Anode%3Apve1',
ROUTE_STATE_REPLACE_OPTIONS,
);
- expect(groupRow.getAttribute('aria-pressed')).toBe('true');
});
expect(screen.getByTestId('storage-summary-scope')).toHaveTextContent('Pinned');
expect(screen.getByRole('button', { name: 'Reset pinned scope' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Unpin summary scope for pve1' })).toHaveAttribute(
+ 'aria-pressed',
+ 'true',
+ );
});
it('shows ceph summary card and pool expand chevron', async () => {
@@ -837,7 +842,7 @@ describe('Storage', () => {
expect(screen.getByText('Primary Ceph')).toBeInTheDocument();
// All pools now have a toggle details button (not just Ceph)
- const toggleBtn = screen.getByRole('button', { name: 'Toggle details for Ceph-Pool-1' });
+ const toggleBtn = screen.getByRole('button', { name: 'Expand Ceph-Pool-1' });
expect(toggleBtn).toBeInTheDocument();
fireEvent.click(toggleBtn);
});
@@ -876,7 +881,7 @@ describe('Storage', () => {
render(() => <Storage />);
- fireEvent.click(screen.getByRole('button', { name: 'Toggle details for tank' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Expand tank' }));
await waitFor(() => {
expect(metricsHistorySpy).toHaveBeenCalledWith(
@@ -999,7 +1004,7 @@ describe('Storage', () => {
const summary = await screen.findByTestId('storage-summary');
- fireEvent.click(screen.getByRole('button', { name: 'Toggle details for Alpha-Store' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Expand Alpha-Store' }));
await waitFor(() => {
expect(
@@ -1151,7 +1156,7 @@ describe('Storage', () => {
})) as unknown as typeof alphaRow.getBoundingClientRect;
alphaRow.scrollIntoView = vi.fn();
- fireEvent.click(screen.getByRole('button', { name: 'Toggle details for Alpha-Store' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Expand Alpha-Store' }));
await waitFor(() => {
expect(screen.getByRole('button', { name: 'Jump to row' })).toBeInTheDocument();
@@ -1262,7 +1267,7 @@ describe('Storage', () => {
render(() => <Storage />);
await screen.findByTestId('storage-summary');
- fireEvent.click(screen.getByRole('button', { name: 'Toggle details for Alpha-Store' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Expand Alpha-Store' }));
await waitFor(() => {
expect(document.querySelector('[data-inline-detail-for="pool:alpha"]')).toBeTruthy();
diff --git a/frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx b/frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx
index 3b91b214bd..7cfe45b770 100644
--- a/frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx
@@ -91,15 +91,16 @@ describe('StorageGroupRow', () => {
return;
}
- expect(row).toHaveAttribute('tabindex', '0');
-
fireEvent.pointerEnter(row, { pointerType: 'mouse' });
expect(onHoverChange).toHaveBeenCalledWith(scope);
- fireEvent.focusIn(row);
+ const scopeButton = screen.getByRole('button', {
+ name: 'Pin summary scope for tower',
+ });
+ fireEvent.focusIn(scopeButton);
expect(onHoverChange).toHaveBeenLastCalledWith(scope);
- fireEvent.keyDown(row, { key: 'Enter' });
+ fireEvent.click(scopeButton);
expect(onFocusChange).toHaveBeenCalledWith(scope);
fireEvent.click(row);
diff --git a/frontend-modern/src/components/shared/NodeGroupHeader.tsx b/frontend-modern/src/components/shared/NodeGroupHeader.tsx
index b77b4bf452..c9f38663a3 100644
--- a/frontend-modern/src/components/shared/NodeGroupHeader.tsx
+++ b/frontend-modern/src/components/shared/NodeGroupHeader.tsx
@@ -7,6 +7,7 @@ import { getNodeStatusIndicator } from '@/utils/status';
interface NodeGroupHeaderProps {
node: Node;
colspan?: number;
+ leadingAction?: JSX.Element;
renderAs?: 'tr' | 'div';
trClass?: string;
trProps?: JSX.HTMLAttributes<HTMLTableRowElement>;
@@ -24,6 +25,7 @@ export const NodeGroupHeader: Component<NodeGroupHeaderProps> = (props) => {
class={`flex flex-wrap items-center gap-3 ${isOnline() ? '' : 'opacity-60'}`}
title={nodeStatus().label}
>
+ {props.leadingAction}
<StatusDot
variant={nodeStatus().variant}
title={nodeStatus().label}
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 76d9bde7d7..e2f1cb27d4 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -61,6 +61,7 @@ import interactiveSparklineModelSource from '@/components/shared/interactiveSpar
import contextualFocusSource from '@/components/shared/contextualFocus.ts?raw';
import summaryCardInteractionSource from '@/components/shared/summaryCardInteraction.ts?raw';
import summaryJumpToRowButtonSource from '@/components/shared/SummaryJumpToRowButton.tsx?raw';
+import summaryRowActionButtonSource from '@/components/shared/SummaryRowActionButton.tsx?raw';
import summaryInteractionA11ySource from '@/components/shared/summaryInteractionA11y.ts?raw';
import summaryScopeBarSource from '@/components/shared/SummaryScopeBar.tsx?raw';
import summaryScopePresentationSource from '@/components/shared/summaryScopePresentation.ts?raw';
@@ -400,11 +401,20 @@ describe('shared primitive guardrails', () => {
});
it('keeps summary-linked row input semantics on the shared interaction helper', () => {
- expect(summaryInteractionA11ySource).toContain('createSummaryInteractiveRowHandlers');
- expect(summaryInteractionA11ySource).toContain('SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS');
- expect(summaryInteractionA11ySource).toContain("event.key === 'Enter' || event.key === ' '");
- expect(summaryInteractionA11ySource).toContain("event.key === 'Escape'");
+ expect(summaryInteractionA11ySource).toContain('createSummaryInteractiveRowPreviewHandlers');
+ expect(summaryInteractionA11ySource).toContain('createSummaryInteractiveActionKeydownHandler');
+ expect(summaryInteractionA11ySource).toContain('buildSummaryDisclosureControlsId');
+ expect(summaryInteractionA11ySource).toContain("event.key === 'Enter'");
+ expect(summaryInteractionA11ySource).toContain("event.code === 'Space'");
+ expect(summaryInteractionA11ySource).toContain("event.key !== 'Escape'");
expect(summaryInteractionA11ySource).toContain("window.matchMedia('(pointer: fine)')");
+ expect(summaryRowActionButtonSource).toContain('SummaryRowActionButton');
+ expect(summaryRowActionButtonSource).toContain("kind: 'disclosure'");
+ expect(summaryRowActionButtonSource).toContain("kind: 'scope'");
+ expect(summaryRowActionButtonSource).toContain('aria-controls');
+ expect(summaryRowActionButtonSource).toContain('aria-expanded');
+ expect(summaryRowActionButtonSource).toContain('aria-pressed');
+ expect(summaryRowActionButtonSource).toContain('data-row-action="true"');
for (const source of [
workloadPanelSource,
@@ -416,8 +426,8 @@ describe('shared primitive guardrails', () => {
unifiedResourcePBSTableSectionSource,
unifiedResourcePMGTableSectionSource,
]) {
- expect(source).toContain('createSummaryInteractiveRowHandlers');
- expect(source).toContain('SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS');
+ expect(source).toContain('createSummaryInteractiveRowPreviewHandlers');
+ expect(source).toContain('SummaryRowActionButton');
}
expect(nodeGroupHeaderSource).toContain('event.stopPropagation()');
diff --git a/frontend-modern/src/components/shared/SummaryRowActionButton.tsx b/frontend-modern/src/components/shared/SummaryRowActionButton.tsx
new file mode 100644
index 0000000000..4208fad038
--- /dev/null
+++ b/frontend-modern/src/components/shared/SummaryRowActionButton.tsx
@@ -0,0 +1,96 @@
+import { Show, type Component } from 'solid-js';
+import {
+ createSummaryInteractiveActionKeydownHandler,
+ SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS,
+} from './summaryInteractionA11y';
+
+type SummaryRowActionButtonProps =
+ | {
+ kind: 'disclosure';
+ expanded: boolean;
+ subjectLabel: string;
+ controlsId?: string;
+ class?: string;
+ onAction: () => void;
+ onPreviewClear?: () => void;
+ }
+ | {
+ kind: 'scope';
+ pressed: boolean;
+ subjectLabel: string;
+ class?: string;
+ inactiveLabel?: string;
+ activeLabel?: string;
+ onAction: () => void;
+ onPreviewClear?: () => void;
+ };
+
+const DISCLOSURE_BUTTON_CLASS = [
+ 'inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted transition-colors',
+ 'hover:bg-surface hover:text-base-content',
+ SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS,
+].join(' ');
+
+const SCOPE_BUTTON_CLASS = [
+ 'inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] transition-colors',
+ 'border-border bg-surface text-muted hover:border-sky-200 hover:text-sky-700 dark:hover:border-sky-900/60 dark:hover:text-sky-300',
+ SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS,
+].join(' ');
+
+export const SummaryRowActionButton: Component<SummaryRowActionButtonProps> = (props) => {
+ const disclosureLabel = () =>
+ props.expanded ? `Collapse ${props.subjectLabel}` : `Expand ${props.subjectLabel}`;
+ const scopeLabel = () =>
+ props.pressed
+ ? `Unpin summary scope for ${props.subjectLabel}`
+ : `Pin summary scope for ${props.subjectLabel}`;
+
+ return (
+ <button
+ type="button"
+ data-row-action="true"
+ class={`${props.kind === 'disclosure' ? DISCLOSURE_BUTTON_CLASS : SCOPE_BUTTON_CLASS} ${props.class ?? ''}`.trim()}
+ aria-label={props.kind === 'disclosure' ? disclosureLabel() : scopeLabel()}
+ aria-expanded={props.kind === 'disclosure' ? props.expanded : undefined}
+ aria-controls={props.kind === 'disclosure' ? props.controlsId : undefined}
+ aria-pressed={props.kind === 'scope' ? props.pressed : undefined}
+ title={props.kind === 'disclosure' ? disclosureLabel() : scopeLabel()}
+ onClick={(event) => {
+ event.stopPropagation();
+ props.onAction();
+ }}
+ onKeyDown={createSummaryInteractiveActionKeydownHandler({
+ onAction: props.onAction,
+ onPreviewClear: props.onPreviewClear,
+ })}
+ >
+ <Show
+ when={props.kind === 'scope'}
+ fallback={
+ <svg
+ class={`h-3.5 w-3.5 transition-transform duration-150 ${props.expanded ? 'rotate-90 text-base-content' : ''}`.trim()}
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke="currentColor"
+ stroke-width="2"
+ aria-hidden="true"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d="M9 5l7 7-7 7"
+ />
+ </svg>
+ }
+ >
+ <span
+ class={`whitespace-nowrap ${props.pressed ? 'border-sky-200 bg-sky-50 px-0 py-0 text-sky-700 dark:border-sky-900/60 dark:bg-sky-950/40 dark:text-sky-300' : ''}`.trim()}
+ >
+ {props.pressed ? (props.activeLabel ?? 'Pinned') : (props.inactiveLabel ?? 'Scope')}
+ </span>
+ </Show>
+ </button>
+ );
+};
+
+export default SummaryRowActionButton;
diff --git a/frontend-modern/src/components/shared/__tests__/SummaryRowActionButton.test.tsx b/frontend-modern/src/components/shared/__tests__/SummaryRowActionButton.test.tsx
new file mode 100644
index 0000000000..c4a221b76c
--- /dev/null
+++ b/frontend-modern/src/components/shared/__tests__/SummaryRowActionButton.test.tsx
@@ -0,0 +1,85 @@
+import { fireEvent, render, screen } from '@solidjs/testing-library';
+import { describe, expect, it, vi } from 'vitest';
+import { SummaryRowActionButton } from '@/components/shared/SummaryRowActionButton';
+
+describe('SummaryRowActionButton', () => {
+ it('owns disclosure semantics with aria-expanded and aria-controls', () => {
+ const onAction = vi.fn();
+ render(() => (
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel="alpha"
+ expanded={true}
+ controlsId="summary-row-detail-alpha"
+ onAction={onAction}
+ />
+ ));
+
+ const button = screen.getByRole('button', { name: 'Collapse alpha' });
+ expect(button).toHaveAttribute('aria-expanded', 'true');
+ expect(button).toHaveAttribute('aria-controls', 'summary-row-detail-alpha');
+
+ fireEvent.click(button);
+ expect(onAction).toHaveBeenCalledTimes(1);
+ });
+
+ it('owns pinned scope semantics with aria-pressed', () => {
+ const onAction = vi.fn();
+ render(() => (
+ <SummaryRowActionButton
+ kind="scope"
+ subjectLabel="tower"
+ pressed={true}
+ onAction={onAction}
+ />
+ ));
+
+ const button = screen.getByRole('button', {
+ name: 'Unpin summary scope for tower',
+ });
+ expect(button).toHaveAttribute('aria-pressed', 'true');
+ expect(button).toHaveTextContent('Pinned');
+
+ fireEvent.click(button);
+ expect(onAction).toHaveBeenCalledTimes(1);
+ });
+
+ it('clears preview and blurs on Escape', () => {
+ const onPreviewClear = vi.fn();
+ render(() => (
+ <SummaryRowActionButton
+ kind="scope"
+ subjectLabel="tower"
+ pressed={false}
+ onAction={vi.fn()}
+ onPreviewClear={onPreviewClear}
+ />
+ ));
+
+ const button = screen.getByRole('button', {
+ name: 'Pin summary scope for tower',
+ }) as HTMLButtonElement;
+ button.blur = vi.fn();
+
+ fireEvent.keyDown(button, { key: 'Escape' });
+ expect(onPreviewClear).toHaveBeenCalledTimes(1);
+ expect(button.blur).toHaveBeenCalledTimes(1);
+ });
+
+ it('activates disclosure buttons from keyboard space', () => {
+ const onAction = vi.fn();
+ render(() => (
+ <SummaryRowActionButton
+ kind="disclosure"
+ subjectLabel="alpha"
+ expanded={false}
+ controlsId="summary-row-detail-alpha"
+ onAction={onAction}
+ />
+ ));
+
+ const button = screen.getByRole('button', { name: 'Expand alpha' });
+ fireEvent.keyDown(button, { key: 'Space', code: 'Space' });
+ expect(onAction).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/frontend-modern/src/components/shared/__tests__/summaryInteractionA11y.test.ts b/frontend-modern/src/components/shared/__tests__/summaryInteractionA11y.test.ts
index 6780fdde00..6605e16147 100644
--- a/frontend-modern/src/components/shared/__tests__/summaryInteractionA11y.test.ts
+++ b/frontend-modern/src/components/shared/__tests__/summaryInteractionA11y.test.ts
@@ -1,10 +1,14 @@
import { describe, expect, it, vi } from 'vitest';
-import { createSummaryInteractiveRowHandlers } from '@/components/shared/summaryInteractionA11y';
+import {
+ buildSummaryDisclosureControlsId,
+ createSummaryInteractiveActionKeydownHandler,
+ createSummaryInteractiveRowPreviewHandlers,
+} from '@/components/shared/summaryInteractionA11y';
describe('summaryInteractionA11y', () => {
it('previews on fine pointers and ignores touch pointers', () => {
const onPreview = vi.fn();
- const handlers = createSummaryInteractiveRowHandlers({ onPreview });
+ const handlers = createSummaryInteractiveRowPreviewHandlers({ onPreview });
handlers.onPointerEnter?.({ pointerType: 'mouse' } as PointerEvent);
handlers.onPointerEnter?.({ pointerType: 'pen' } as PointerEvent);
@@ -13,10 +17,10 @@ describe('summaryInteractionA11y', () => {
expect(onPreview).toHaveBeenCalledTimes(2);
});
- it('previews on focus and only clears once focus leaves the row subtree', () => {
+ it('previews on focus within the row and clears once focus leaves the subtree', () => {
const onPreview = vi.fn();
const onPreviewClear = vi.fn();
- const handlers = createSummaryInteractiveRowHandlers({ onPreview, onPreviewClear });
+ const handlers = createSummaryInteractiveRowPreviewHandlers({ onPreview, onPreviewClear });
const row = document.createElement('tr');
const child = document.createElement('button');
row.appendChild(child);
@@ -35,56 +39,62 @@ describe('summaryInteractionA11y', () => {
expect(onPreviewClear).toHaveBeenCalledTimes(1);
});
- it('toggles only when the row itself handles Enter or Space, and Escape clears preview', () => {
- const onPreviewClear = vi.fn();
- const onToggle = vi.fn();
- const handlers = createSummaryInteractiveRowHandlers({ onPreviewClear, onToggle });
- const row = document.createElement('tr');
- const child = document.createElement('button');
- row.appendChild(child);
- row.blur = vi.fn();
+ it('activates the shared action control on Enter and Space', () => {
+ const onAction = vi.fn();
+ const onKeyDown = createSummaryInteractiveActionKeydownHandler({ onAction });
+ const button = document.createElement('button');
const enterPreventDefault = vi.fn();
- handlers.onKeyDown?.({
+ onKeyDown({
key: 'Enter',
- currentTarget: row,
- target: row,
+ code: 'Enter',
+ currentTarget: button,
preventDefault: enterPreventDefault,
} as KeyboardEvent & {
- currentTarget: HTMLElement;
- target: EventTarget | null;
+ currentTarget: HTMLButtonElement;
preventDefault: () => void;
});
- const childSpacePreventDefault = vi.fn();
- handlers.onKeyDown?.({
- key: ' ',
- currentTarget: row,
- target: child,
- preventDefault: childSpacePreventDefault,
+ const spacePreventDefault = vi.fn();
+ onKeyDown({
+ key: 'Space',
+ code: 'Space',
+ currentTarget: button,
+ preventDefault: spacePreventDefault,
} as KeyboardEvent & {
- currentTarget: HTMLElement;
- target: EventTarget | null;
+ currentTarget: HTMLButtonElement;
preventDefault: () => void;
});
- const escapePreventDefault = vi.fn();
- handlers.onKeyDown?.({
+ expect(onAction).toHaveBeenCalledTimes(2);
+ expect(enterPreventDefault).toHaveBeenCalledTimes(1);
+ expect(spacePreventDefault).toHaveBeenCalledTimes(1);
+ });
+
+ it('clears preview and blurs on Escape from the shared action control', () => {
+ const onPreviewClear = vi.fn();
+ const onKeyDown = createSummaryInteractiveActionKeydownHandler({ onPreviewClear });
+ const button = document.createElement('button');
+ button.blur = vi.fn();
+
+ const preventDefault = vi.fn();
+ onKeyDown({
key: 'Escape',
- currentTarget: row,
- target: row,
- preventDefault: escapePreventDefault,
+ currentTarget: button,
+ preventDefault,
} as KeyboardEvent & {
- currentTarget: HTMLElement;
- target: EventTarget | null;
+ currentTarget: HTMLButtonElement;
preventDefault: () => void;
});
- expect(onToggle).toHaveBeenCalledTimes(1);
- expect(enterPreventDefault).toHaveBeenCalledTimes(1);
- expect(childSpacePreventDefault).not.toHaveBeenCalled();
expect(onPreviewClear).toHaveBeenCalledTimes(1);
- expect(escapePreventDefault).toHaveBeenCalledTimes(1);
- expect(row.blur).toHaveBeenCalledTimes(1);
+ expect(preventDefault).toHaveBeenCalledTimes(1);
+ expect(button.blur).toHaveBeenCalledTimes(1);
+ });
+
+ it('builds stable disclosure control ids from summary series ids', () => {
+ expect(buildSummaryDisclosureControlsId('resource:alpha/01')).toBe(
+ 'summary-row-detail-resource-alpha-01',
+ );
});
});
diff --git a/frontend-modern/src/components/shared/summaryInteractionA11y.ts b/frontend-modern/src/components/shared/summaryInteractionA11y.ts
index 979dd472e5..de86ff327c 100644
--- a/frontend-modern/src/components/shared/summaryInteractionA11y.ts
+++ b/frontend-modern/src/components/shared/summaryInteractionA11y.ts
@@ -1,7 +1,7 @@
import type { JSX } from 'solid-js';
-export const SUMMARY_INTERACTIVE_ROW_FOCUS_CLASS =
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400/70 focus-visible:ring-inset';
+export const SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS =
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400/70';
const isFinePointerEvent = (event: PointerEvent): boolean => {
const pointerType = typeof event.pointerType === 'string' ? event.pointerType : '';
@@ -17,22 +17,17 @@ const isFinePointerEvent = (event: PointerEvent): boolean => {
return true;
};
-const isCurrentTargetKeyboardEvent = (event: KeyboardEvent): boolean =>
- event.target === event.currentTarget;
-
-interface SummaryInteractiveRowHandlersOptions {
+interface SummaryInteractiveRowPreviewOptions {
onPreview?: () => void;
onPreviewClear?: () => void;
- onToggle?: () => void;
}
-export const createSummaryInteractiveRowHandlers = (
- options: SummaryInteractiveRowHandlersOptions,
+export const createSummaryInteractiveRowPreviewHandlers = (
+ options: SummaryInteractiveRowPreviewOptions,
): Pick<
JSX.HTMLAttributes<HTMLElement>,
- 'onFocusIn' | 'onFocusOut' | 'onKeyDown' | 'onPointerEnter' | 'onPointerLeave' | 'tabIndex'
+ 'onFocusIn' | 'onFocusOut' | 'onPointerEnter' | 'onPointerLeave'
> => ({
- tabIndex: 0,
onPointerEnter: (event) => {
if (isFinePointerEvent(event)) {
options.onPreview?.();
@@ -53,21 +48,34 @@ export const createSummaryInteractiveRowHandlers = (
}
options.onPreviewClear?.();
},
- onKeyDown: (event) => {
- if (!isCurrentTargetKeyboardEvent(event)) {
- return;
- }
+});
- if (event.key === 'Enter' || event.key === ' ') {
- event.preventDefault();
- options.onToggle?.();
- return;
- }
+interface SummaryInteractiveActionKeydownOptions {
+ onAction?: () => void;
+ onPreviewClear?: () => void;
+}
- if (event.key === 'Escape') {
- event.preventDefault();
- options.onPreviewClear?.();
- event.currentTarget.blur();
- }
- },
-});
+export const createSummaryInteractiveActionKeydownHandler = (
+ options: SummaryInteractiveActionKeydownOptions,
+): JSX.EventHandlerUnion<HTMLButtonElement, KeyboardEvent> => (event) => {
+ if (
+ event.key === 'Enter' ||
+ event.key === ' ' ||
+ event.key === 'Space' ||
+ event.code === 'Space'
+ ) {
+ event.preventDefault();
+ options.onAction?.();
+ return;
+ }
+
+ if (event.key !== 'Escape') {
+ return;
+ }
+ event.preventDefault();
+ options.onPreviewClear?.();
+ event.currentTarget.blur();
+};
+
+export const buildSummaryDisclosureControlsId = (seriesId: string): string =>
+ `summary-row-detail-${seriesId.replace(/[^a-zA-Z0-9_-]+/g, '-')}`;
diff --git a/frontend-modern/src/features/storageBackups/diskPresentation.ts b/frontend-modern/src/features/storageBackups/diskPresentation.ts
index d863dc2834..f5d8127d58 100644
--- a/frontend-modern/src/features/storageBackups/diskPresentation.ts
+++ b/frontend-modern/src/features/storageBackups/diskPresentation.ts
@@ -74,7 +74,6 @@ export const PHYSICAL_DISK_TABLE_ROW_CLASS = 'cursor-pointer transition-colors';
export const PHYSICAL_DISK_TABLE_ROW_SELECTED_CLASS = 'bg-blue-50 dark:bg-blue-900';
export const PHYSICAL_DISK_TABLE_ROW_HOVER_CLASS = 'hover:bg-surface-hover';
export const PHYSICAL_DISK_TABLE_ROW_STYLE = { height: '38px' } as const;
-export const PHYSICAL_DISK_EXPAND_BUTTON_CLASS = 'rounded p-1 hover:bg-surface-hover transition-colors';
export const PHYSICAL_DISK_DETAIL_ROW_CELL_CLASS =
'border-b border-border-subtle bg-surface-alt px-4 py-4 shadow-inner';
export const PHYSICAL_DISK_HEADER_DISK_CLASS =
@@ -92,7 +91,6 @@ export const PHYSICAL_DISK_HEADER_TEMP_CLASS =
'hidden md:table-cell px-1.5 sm:px-2 py-0.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[72px]';
export const PHYSICAL_DISK_HEADER_SIZE_CLASS =
'px-1.5 sm:px-2 py-0.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[96px]';
-export const PHYSICAL_DISK_HEADER_EXPAND_CLASS = 'px-1.5 py-1 w-10';
export const PHYSICAL_DISK_CELL_DISK_CLASS = 'px-1.5 sm:px-2 py-1 align-middle text-xs md:min-w-[220px]';
export const PHYSICAL_DISK_CELL_SOURCE_CLASS = 'px-1.5 sm:px-2 py-1 align-middle text-xs w-[72px]';
export const PHYSICAL_DISK_CELL_HOST_CLASS = 'px-1.5 sm:px-2 py-1 align-middle text-xs md:min-w-[120px]';
@@ -103,8 +101,7 @@ export const PHYSICAL_DISK_CELL_TEMP_CLASS =
'hidden md:table-cell px-1.5 sm:px-2 py-1 align-middle text-xs whitespace-nowrap w-[72px]';
export const PHYSICAL_DISK_CELL_SIZE_CLASS =
'px-1.5 sm:px-2 py-1 align-middle text-xs whitespace-nowrap w-[96px]';
-export const PHYSICAL_DISK_CELL_EXPAND_CLASS = 'px-1.5 py-1 align-middle text-right';
-export const PHYSICAL_DISK_NAME_WRAP_CLASS = 'flex min-w-0 items-center whitespace-nowrap';
+export const PHYSICAL_DISK_NAME_WRAP_CLASS = 'flex min-w-0 items-center gap-1.5 whitespace-nowrap';
export const PHYSICAL_DISK_NAME_TEXT_CLASS = 'block min-w-0 truncate text-[12px] font-semibold text-base-content';
export const PHYSICAL_DISK_SOURCE_BADGE_CLASS =
'inline-flex min-w-[3.25rem] justify-center px-1.5 py-px text-[9px] font-medium';
@@ -115,8 +112,6 @@ export const PHYSICAL_DISK_HEALTH_LABEL_CLASS = 'shrink-0 text-[11px] font-semib
export const PHYSICAL_DISK_HEALTH_SUMMARY_CLASS = 'hidden xl:block truncate text-[11px] text-muted';
export const PHYSICAL_DISK_TEMPERATURE_CLASS = 'text-[11px] font-medium';
export const PHYSICAL_DISK_SIZE_VALUE_CLASS = 'text-[11px] text-base-content';
-export const PHYSICAL_DISK_EXPAND_ICON_BASE_CLASS =
- 'h-3.5 w-3.5 text-muted transition-transform duration-150';
const titleize = (value: string | undefined | null): string =>
(value || '')
@@ -140,10 +135,6 @@ export function getPhysicalDiskSourceBadgePresentation(resource: Resource): {
};
}
-export function getPhysicalDiskExpandIconClass(expanded: boolean): string {
- return `${PHYSICAL_DISK_EXPAND_ICON_BASE_CLASS} ${expanded ? 'rotate-90' : ''}`.trim();
-}
-
export function getPhysicalDiskHostLabel(
disk: PhysicalDiskPresentationData,
resource: Resource,
diff --git a/frontend-modern/src/features/storageBackups/storagePagePresentation.ts b/frontend-modern/src/features/storageBackups/storagePagePresentation.ts
index 12a88c9f21..3e144c18d9 100644
--- a/frontend-modern/src/features/storageBackups/storagePagePresentation.ts
+++ b/frontend-modern/src/features/storageBackups/storagePagePresentation.ts
@@ -60,10 +60,6 @@ export const STORAGE_POOL_TABLE_COLUMNS: readonly StoragePoolTableColumn[] = [
label: 'Primary Issue',
className: 'px-1.5 sm:px-2 py-0.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider',
},
- {
- label: '',
- className: 'px-1.5 sm:px-2 py-0.5 w-10',
- },
];
export const STORAGE_BANNER_ACTION_BUTTON_CLASS =
diff --git a/frontend-modern/src/features/storageBackups/storagePoolRowPresentation.ts b/frontend-modern/src/features/storageBackups/storagePoolRowPresentation.ts
index aea15ee0f2..9281600e30 100644
--- a/frontend-modern/src/features/storageBackups/storagePoolRowPresentation.ts
+++ b/frontend-modern/src/features/storageBackups/storagePoolRowPresentation.ts
@@ -51,12 +51,8 @@ export const STORAGE_POOL_ROW_IMPACT_CELL_CLASS =
'hidden lg:table-cell px-2 py-1 align-middle text-[11px] text-base-content';
export const STORAGE_POOL_ROW_ISSUE_CELL_CLASS = 'px-2 py-1 align-middle text-[11px]';
export const STORAGE_POOL_ROW_ISSUE_TEXT_CLASS = 'block truncate text-[11px] font-semibold';
-export const STORAGE_POOL_ROW_EXPAND_CELL_CLASS = 'px-1.5 py-1 align-middle text-right';
-export const STORAGE_POOL_ROW_EXPAND_BUTTON_CLASS = 'rounded p-1 hover:bg-surface-hover transition-colors';
export const STORAGE_POOL_ROW_PLACEHOLDER_CLASS = 'text-muted';
export const STORAGE_POOL_ROW_USAGE_FALLBACK_CLASS = 'text-[11px] text-muted';
-export const STORAGE_POOL_ROW_EXPAND_ICON_BASE_CLASS =
- 'h-3.5 w-3.5 text-muted transition-transform duration-150';
export const buildStoragePoolRowModel = (record: StorageRecord): StoragePoolRowModel => {
const totalBytes = record.capacity.totalBytes || 0;
@@ -82,8 +78,5 @@ export const buildStoragePoolRowModel = (record: StorageRecord): StoragePoolRowM
};
};
-export const getStoragePoolExpandIconClass = (expanded: boolean): string =>
- `${STORAGE_POOL_ROW_EXPAND_ICON_BASE_CLASS} ${expanded ? 'rotate-90' : ''}`.trim();
-
export const getStoragePoolImpactTextClass = (impact: string): string =>
`${STORAGE_POOL_ROW_TEXT_TRUNCATE_CLASS} ${impact === '—' ? STORAGE_POOL_ROW_PLACEHOLDER_CLASS : ''}`.trim();
diff --git a/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts b/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts
index 20795070c4..fea179bc9e 100644
--- a/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts
+++ b/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts
@@ -316,8 +316,10 @@ test.describe.serial("Inline selection scroll stability", () => {
const workloadId = (await row.getAttribute("data-guest-id")) ?? "";
expect(workloadId).not.toBe("");
- await row.focus();
- await expect(row).toBeFocused();
+ const toggleButton = row.locator("button[aria-controls]").first();
+ await expect(toggleButton).toBeVisible();
+ await toggleButton.focus();
+ await expect(toggleButton).toBeFocused();
await page.keyboard.press("Enter");
await expect(page).toHaveURL(/\/workloads\?(?:.*&)?resource=/);
@@ -330,8 +332,8 @@ test.describe.serial("Inline selection scroll stability", () => {
const detailRow = row.locator("xpath=following-sibling::tr[1]");
await expect(detailRow).toContainText("Overview");
- await row.focus();
- await page.keyboard.press(" ");
+ await toggleButton.focus();
+ await toggleButton.press("Space");
await expect.poll(() => page.url()).not.toContain("resource=");
{
const closedUrl = new URL(page.url());
diff --git a/tests/integration/tests/48-summary-hover-selection.spec.ts b/tests/integration/tests/48-summary-hover-selection.spec.ts
index 0bb82054cb..b4d093dd54 100644
--- a/tests/integration/tests/48-summary-hover-selection.spec.ts
+++ b/tests/integration/tests/48-summary-hover-selection.spec.ts
@@ -1051,18 +1051,21 @@ test.describe.serial("Summary hover selection", () => {
return;
}
- await matchedGroupRow.focus();
+ const scopeButton = matchedGroupRow.getByRole("button", {
+ name: /pin summary scope for/i,
+ });
+ await scopeButton.focus();
await expect(scopeBar).toContainText("Preview");
await page.keyboard.press("Escape");
await expect(scopeBar).toContainText("All");
- await matchedGroupRow.focus();
+ await scopeButton.focus();
await expect(scopeBar).toContainText("Preview");
await page.keyboard.press("Enter");
await expect
.poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
.toBe(matchedGroupId);
- await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "true");
+ await expect(scopeButton).toHaveAttribute("aria-pressed", "true");
await expect(scopeBar).toContainText("Pinned");
await expect(
scopeBar.getByRole("button", { name: "Reset pinned scope" }),
@@ -1147,18 +1150,21 @@ test.describe.serial("Summary hover selection", () => {
return;
}
- await matchedGroupRow.focus();
+ const scopeButton = matchedGroupRow.getByRole("button", {
+ name: /pin summary scope for/i,
+ });
+ await scopeButton.focus();
await expect(storageScopeBar).toContainText("Preview");
await page.keyboard.press("Escape");
await expect(storageScopeBar).toContainText("All");
- await matchedGroupRow.focus();
+ await scopeButton.focus();
await expect(storageScopeBar).toContainText("Preview");
- await page.keyboard.press(" ");
+ await scopeButton.press("Space");
await expect
.poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
.toBe(matchedGroupId);
- await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "true");
+ await expect(scopeButton).toHaveAttribute("aria-pressed", "true");
await expect(storageScopeBar).toContainText("Pinned");
await expect(page.locator("tr[data-row-id]")).toHaveCount(baselineVisibleRows);