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.

Keep keyboard focus through Backups read recovery

pulse-triage[bot]e9e82da08263
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index e7b1a0508a..388794b2f3 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -20,6 +20,23 @@
## Purpose
+### Backup read recovery retains keyboard position
+
+PVE, PBS and protection-posture retries remain focusable while pending, report
+`aria-disabled`, and reject duplicate activation. A failed retry retains its
+control. When a recovered notice or whole-inventory error is removed, focus
+owned by that content moves to the existing active Backups view link, or the
+named inspection region when kiosk mode hides navigation. Recovery never
+moves focus the operator has taken elsewhere, or restores it after leaving
+the surface. Independent inventory, server health, assessment withdrawal,
+read cadence, filters, guest operations and protection policy are unchanged.
+
+`ProxmoxBackupsTable.test.tsx` exercises pending/failed/successful retries,
+duplicate activation, partial whole-inventory recovery, moved focus, kiosk
+fallback and disposal. Desktop and narrow browser proof must exercise the
+real HTTP clients, keyboard input, ordinary polling and consuming pixels.
+This is inspection accessibility, not original guest or installed recovery.
+
### Runtime alert controls describe only supported scope (28 October 2026)
Container Runtime rows expose their existing Offline Alerts control, not an
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 096e2c6938..08be7bf46d 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -21,6 +21,23 @@
## Purpose
+### Backup read recovery retains keyboard position
+
+PVE, PBS and protection-posture retries remain focusable while pending, report
+`aria-disabled`, and reject duplicate activation. A failed retry retains its
+control. When a recovered notice or whole-inventory error is removed, focus
+owned by that content moves to the existing active Backups view link, or the
+named inspection region when kiosk mode hides navigation. Recovery never
+moves focus the operator has taken elsewhere, or restores it after leaving
+the surface. Independent inventory, server health, assessment withdrawal,
+read cadence, filters, guest operations and protection policy are unchanged.
+
+`ProxmoxBackupsTable.test.tsx` exercises pending/failed/successful retries,
+duplicate activation, partial whole-inventory recovery, moved focus, kiosk
+fallback and disposal. Desktop and narrow browser proof must exercise the
+real HTTP clients, keyboard input, ordinary polling and consuming pixels.
+This is inspection accessibility, not original guest or installed recovery.
+
### Protection assessments require explicit, valid instants
The browser admits assessment and provider timestamps only as calendar-valid,
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
index 7dffe447d0..0e9b9c0756 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
@@ -4,6 +4,7 @@ import {
createEffect,
createMemo,
createSignal,
+ onCleanup,
type Component,
type JSX,
} from 'solid-js';
@@ -134,6 +135,22 @@ export const ProxmoxBackupsTable: Component<{
workloads?: readonly Resource[];
servers?: readonly Resource[];
}> = (props) => {
+ let inspection: HTMLDivElement | undefined;
+ // Recovering a read removes its notice (or the whole-inventory error).
+ // Hand off only focus owned by that retiring content, never focus the
+ // operator has moved elsewhere or focus after leaving this surface.
+ const retainRecoveryFocus = (notice: HTMLElement): void => {
+ onCleanup(() => {
+ if (!notice.contains(document.activeElement)) return;
+ queueMicrotask(() => {
+ if (!inspection?.isConnected || document.activeElement !== document.body) return;
+ const activeView = inspection.querySelector<HTMLElement>(
+ 'nav[aria-label="Backup views"] [aria-current="page"]',
+ );
+ (activeView ?? inspection).focus();
+ });
+ });
+ };
// Independent read owners contain source failures and replace pending reads
// on org changes/disposal. Refresh while mounted at the same bounded cadence
// as protection posture; no cross-route inventory cache or per-row reads.
@@ -724,11 +741,18 @@ export const ProxmoxBackupsTable: Component<{
);
return (
- <div class="space-y-3">
+ <div
+ ref={inspection}
+ role="region"
+ aria-label="Backup inspection"
+ tabIndex={-1}
+ class="space-y-3"
+ >
<For each={inventorySources}>
{({ label, query }) => (
<Show when={!query.resolvedOnce() || query.error()}>
<div
+ ref={retainRecoveryFocus}
role="status"
class={`${BACKUP_READ_NOTICE_CLASS} flex flex-wrap items-center justify-between gap-2`}
>
@@ -744,10 +768,12 @@ export const ProxmoxBackupsTable: Component<{
<Show when={query.error()}>
<button
type="button"
- class="min-h-10 shrink-0 rounded-md border border-current px-3 font-medium hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50"
+ class="min-h-10 shrink-0 rounded-md border border-current px-3 font-medium hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 aria-disabled:opacity-50"
aria-label={`Retry ${label} inventory`}
- disabled={query.loading()}
- onClick={() => void query.refetch()}
+ aria-disabled={query.loading()}
+ onClick={() => {
+ if (!query.loading()) void query.refetch();
+ }}
>
{query.loading() ? 'Retrying…' : `Retry ${label} inventory`}
</button>
@@ -770,11 +796,13 @@ export const ProxmoxBackupsTable: Component<{
<Show
when={!allInventoriesFailed()}
fallback={
- <PlatformErrorState
- title="Could not load Proxmox backup inventory"
- description="PVE and PBS backup inventories are unavailable. Counts are incomplete. Refresh to retry both sources."
- onRefresh={retryAllInventories}
- />
+ <div ref={retainRecoveryFocus}>
+ <PlatformErrorState
+ title="Could not load Proxmox backup inventory"
+ description="PVE and PBS backup inventories are unavailable. Counts are incomplete. Refresh to retry both sources."
+ onRefresh={retryAllInventories}
+ />
+ </div>
}
>
<Show
@@ -792,6 +820,7 @@ export const ProxmoxBackupsTable: Component<{
<PlatformSectionTabs tabs={backupViewTabs()} active={view()} ariaLabel="Backup views" />
<Show when={protectionPostures.response.error}>
<div
+ ref={retainRecoveryFocus}
role="status"
class={`${BACKUP_READ_NOTICE_CLASS} flex flex-wrap items-center justify-between gap-2`}
>
@@ -801,10 +830,12 @@ export const ProxmoxBackupsTable: Component<{
</span>
<button
type="button"
- class="min-h-10 shrink-0 rounded-md border border-current px-3 font-medium hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50"
+ class="min-h-10 shrink-0 rounded-md border border-current px-3 font-medium hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 aria-disabled:opacity-50"
aria-label="Retry protection posture"
- disabled={protectionPostures.response.loading}
- onClick={() => void protectionPostures.refetch()}
+ aria-disabled={protectionPostures.response.loading}
+ onClick={() => {
+ if (!protectionPostures.response.loading) void protectionPostures.refetch();
+ }}
>
{protectionPostures.response.loading ? 'Retrying…' : 'Retry protection posture'}
</button>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
index 02b61041f4..9262f7ead1 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
@@ -29,6 +29,7 @@ import {
getRecoveryPrettyDateLabel,
} from '@/utils/recoveryDatePresentation';
import { eventBus } from '@/stores/events';
+import { setKioskMode } from '@/utils/url';
import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';
// ProxmoxBackupsTable reads URL search params (node/type scope filters), so it
@@ -965,6 +966,164 @@ const serverTable = () => document.querySelector('[data-proxmox-backups-table="s
const sourceCalls = (source: 'pve' | 'pbs') =>
apiFetchMock.mock.calls.filter(([url]) => url === `/api/backups/${source}`);
+describe('backup read recovery keeps keyboard position', () => {
+ beforeEach(() => window.history.replaceState({}, '', '/proxmox/backups/coverage?q=backup#proof'));
+ afterEach(() => {
+ setKioskMode(false);
+ window.sessionStorage.removeItem('pulse_kiosk_mode');
+ });
+
+ const acceptedPosture = { data: [protectionPosture('ct-112')], policy: protectionPolicy };
+ const setup = (source: 'pve' | 'pbs' | 'posture') => {
+ let read = Promise.resolve(new Response('{}', { status: 503 }));
+ apiFetchMock.mockImplementation((url: string) =>
+ url.endsWith(`/${source}`)
+ ? read
+ : Promise.resolve(jsonResponse(url.endsWith('/pve') ? readPvePayload : pbsPayload)),
+ );
+ apiFetchJSONMock.mockImplementation(() =>
+ source === 'posture'
+ ? read.then(async (response) => {
+ if (!response.ok) throw new Error('Synthetic unavailable posture');
+ return response.json();
+ })
+ : Promise.resolve(acceptedPosture),
+ );
+ return {
+ mount: () => mountBackupReadState(),
+ pending: () => {
+ const pending = deferred<Response>();
+ read = pending.promise;
+ return (success = true) =>
+ pending.resolve(
+ success
+ ? jsonResponse(
+ source === 'posture'
+ ? acceptedPosture
+ : source === 'pve'
+ ? readPvePayload
+ : pbsPayload,
+ )
+ : new Response('{}', { status: 503 }),
+ );
+ },
+ label:
+ source === 'posture'
+ ? 'Retry protection posture'
+ : `Retry ${source.toUpperCase()} inventory`,
+ };
+ };
+
+ it.each(['pve', 'pbs', 'posture'] as const)(
+ 'keeps %s retry focused while pending and after failure, then hands successful recovery to the active view',
+ async (source) => {
+ const fixture = setup(source);
+ fixture.mount();
+ const retry = await screen.findByRole('button', { name: fixture.label });
+ retry.focus();
+ let finish = fixture.pending();
+ fireEvent.click(retry);
+ expect(retry).toHaveFocus();
+ expect(retry).toHaveAttribute('aria-disabled', 'true');
+ const count = apiFetchMock.mock.calls.length + apiFetchJSONMock.mock.calls.length;
+ fireEvent.click(retry);
+ expect(apiFetchMock.mock.calls.length + apiFetchJSONMock.mock.calls.length).toBe(count);
+ finish(false);
+ await waitFor(() => expect(retry).toHaveAttribute('aria-disabled', 'false'));
+ expect(retry).toHaveFocus();
+ finish = fixture.pending();
+ fireEvent.click(retry);
+ finish();
+ await waitFor(() =>
+ expect(screen.getByRole('link', { name: 'Coverage', exact: true })).toHaveFocus(),
+ );
+ expect(screen.queryByRole('button', { name: fixture.label })).toBeNull();
+ expect(window.location.pathname + window.location.search + window.location.hash).toBe(
+ '/proxmox/backups/coverage?q=backup#proof',
+ );
+ },
+ );
+
+ it.each(['pve', 'pbs', 'posture'] as const)(
+ 'does not steal focus moved away from the %s retry',
+ async (source) => {
+ const fixture = setup(source);
+ fixture.mount();
+ const retry = await screen.findByRole('button', { name: fixture.label });
+ retry.focus();
+ const finish = fixture.pending();
+ fireEvent.click(retry);
+ const search = screen.getByPlaceholderText(
+ 'Search backups by workload, node, source, or status',
+ );
+ search.focus();
+ finish();
+ await waitFor(() => expect(retry).not.toBeInTheDocument());
+ expect(search).toHaveFocus();
+ },
+ );
+
+ it('hands whole-inventory Refresh focus to inspection when either source recovers', async () => {
+ apiFetchMock.mockResolvedValue(new Response('{}', { status: 503 }));
+ apiFetchJSONMock.mockResolvedValue(acceptedPosture);
+ mountBackupReadState();
+ const refresh = await screen.findByRole('button', { name: 'Refresh', exact: true });
+ refresh.focus();
+ const pve = deferred<Response>();
+ const pbs = deferred<Response>();
+ apiFetchMock.mockImplementation((url: string) =>
+ url.endsWith('/pve') ? pve.promise : pbs.promise,
+ );
+ fireEvent.click(refresh);
+ fireEvent.click(refresh);
+ expect(sourceCalls('pve')).toHaveLength(2);
+ expect(sourceCalls('pbs')).toHaveLength(2);
+ pve.resolve(jsonResponse(readPvePayload));
+ await waitFor(() =>
+ expect(screen.getByRole('link', { name: 'Coverage', exact: true })).toHaveFocus(),
+ );
+ expect(screen.getByRole('button', { name: 'Retry PBS inventory' })).toBeInTheDocument();
+ pbs.resolve(jsonResponse(pbsPayload));
+ await waitFor(() =>
+ expect(screen.queryByRole('button', { name: 'Retry PBS inventory' })).toBeNull(),
+ );
+ expect(screen.getByRole('link', { name: 'Coverage', exact: true })).toHaveFocus();
+ });
+
+ it('uses the named inspection region when kiosk mode hides the view links', async () => {
+ setKioskMode(true);
+ const fixture = setup('pbs');
+ fixture.mount();
+ const retry = await screen.findByRole('button', { name: fixture.label });
+ retry.focus();
+ const finish = fixture.pending();
+ fireEvent.click(retry);
+ finish();
+ await waitFor(() =>
+ expect(screen.getByRole('region', { name: 'Backup inspection' })).toHaveFocus(),
+ );
+ expect(screen.queryByRole('navigation', { name: 'Backup views' })).toBeNull();
+ });
+
+ it('never restores focus after the inspection has been unmounted', async () => {
+ const fixture = setup('pbs');
+ const mounted = fixture.mount();
+ const retry = await screen.findByRole('button', { name: fixture.label });
+ retry.focus();
+ const finish = fixture.pending();
+ fireEvent.click(retry);
+ mounted.unmount();
+ const outside = document.createElement('button');
+ document.body.append(outside);
+ outside.focus();
+ finish();
+ await Promise.resolve();
+ await Promise.resolve();
+ expect(outside).toHaveFocus();
+ outside.remove();
+ });
+});
+
describe('independent Proxmox backup inventory reads', () => {
beforeEach(() => {
window.history.replaceState({}, '', '/proxmox/backups/date');
@@ -991,7 +1150,7 @@ describe('independent Proxmox backup inventory reads', () => {
response = pending.promise;
const retry = screen.getByRole('button', { name: `Retry ${source.toUpperCase()} inventory` });
fireEvent.click(retry);
- expect(retry).toBeDisabled();
+ expect(retry).toHaveAttribute('aria-disabled', 'true');
expect(screen.getByText(/The response format is invalid/)).toBeInTheDocument();
expect(recoverableRows()).toHaveLength(1);
pending.resolve(jsonResponse(source === 'pbs' ? pbsPayload : readPvePayload));
@@ -1112,7 +1271,7 @@ describe('independent Proxmox backup inventory reads', () => {
const pending = deferred<Response>();
response = pending.promise;
fireEvent.click(retry);
- expect(retry).toBeDisabled();
+ expect(retry).toHaveAttribute('aria-disabled', 'true');
fireEvent.click(retry);
expect(sourceCalls(source)).toHaveLength(2);
expect(recoverableRows()).toHaveLength(1);
@@ -1726,7 +1885,7 @@ describe('Coverage withdraws failed protection assessments', () => {
apiFetchJSONMock.mockReturnValue(pending.promise);
const retry = screen.getByRole('button', { name: 'Retry protection posture' });
fireEvent.click(retry);
- expect(retry).toBeDisabled();
+ expect(retry).toHaveAttribute('aria-disabled', 'true');
expect(retry).toHaveTextContent('Retrying');
expect(row()).toHaveTextContent('Unknown');
fireEvent.click(retry);