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 position while notification activity refreshes

pulse-triage[bot]4b48b39793cc
diff --git a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx
index d397c201ba..5eb146aa7c 100644
--- a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx
+++ b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.test.tsx
@@ -144,6 +144,37 @@ describe('AlertDeliveryLogCard', () => {
expect(screen.getByText('held-keyboard-evidence')).toBeInTheDocument();
});
+ it('keeps refresh keyboard focus while busy without admitting duplicate reads', () => {
+ const [refreshing, setRefreshing] = createSignal(false);
+ const onRefresh = vi.fn(() => setRefreshing(true));
+ render(() => (
+ <AlertDeliveryLogCard
+ log={log}
+ unavailable={false}
+ refreshing={refreshing()}
+ onRefresh={onRefresh}
+ webhooks={webhooks}
+ />
+ ));
+ const refresh = screen.getByRole('button', { name: 'Refresh delivery status' });
+ refresh.focus();
+ refresh.click();
+ expect(onRefresh).toHaveBeenCalledTimes(1);
+ expect(refresh).toHaveAttribute('aria-disabled', 'true');
+ // Native disabled controls lose keyboard focus in WebKit. Keep the
+ // button mounted and focusable, but reject both mouse and keyboard clicks.
+ expect(refresh).not.toHaveAttribute('disabled');
+ expect(refresh).toHaveFocus();
+ refresh.click();
+ expect(onRefresh).toHaveBeenCalledTimes(1);
+
+ setRefreshing(false);
+ expect(refresh).toHaveAttribute('aria-disabled', 'false');
+ expect(refresh).toHaveFocus();
+ refresh.click();
+ expect(onRefresh).toHaveBeenCalledTimes(2);
+ });
+
it('says test sends are not listed so their absence is not read as failure', () => {
render(() => (
<AlertDeliveryLogCard
diff --git a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx
index 325f720f68..02b09d3ab8 100644
--- a/frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx
+++ b/frontend-modern/src/features/alerts/AlertDeliveryLogCard.tsx
@@ -158,9 +158,11 @@ export function AlertDeliveryLogCard(props: AlertDeliveryLogCardProps) {
</div>
<button
type="button"
- class="inline-flex shrink-0 items-center justify-center gap-2 rounded-md border border-gray-300 bg-transparent px-3 py-1.5 text-sm font-medium text-gray-700 transition hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700/40"
- disabled={props.refreshing}
- onClick={props.onRefresh}
+ class="inline-flex shrink-0 items-center justify-center gap-2 rounded-md border border-gray-300 bg-transparent px-3 py-1.5 text-sm font-medium text-gray-700 transition hover:bg-gray-100 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700/40"
+ aria-disabled={props.refreshing}
+ onClick={() => {
+ if (!props.refreshing) props.onRefresh();
+ }}
>
<RefreshCwIcon class={`h-4 w-4 ${props.refreshing ? 'animate-spin' : ''}`} />
{getAlertDestinationsDeliveryRefreshLabel()}