From 6784b8f6be57e1a4f936f9caa5b8363e9da0481f Mon Sep 17 00:00:00 2001 From: Pouzor Date: Wed, 3 Jun 2026 01:31:50 +0200 Subject: [PATCH] refactor(ui): harden pending-devices keyboard handler Address review nits on the close/Enter fix: - Add statusFilter to the keydown effect deps so Enter dispatches the correct bulk action regardless of whether the device list changes - Drop redundant title="Close" on the X (aria-label is enough) ha-relevant: maybe --- frontend/src/components/modals/PendingDevicesModal.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/modals/PendingDevicesModal.tsx b/frontend/src/components/modals/PendingDevicesModal.tsx index 2cf8ffb..de35096 100644 --- a/frontend/src/components/modals/PendingDevicesModal.tsx +++ b/frontend/src/components/modals/PendingDevicesModal.tsx @@ -383,8 +383,10 @@ export function PendingDevicesModal({ open, onClose, highlightId, initialStatus } window.addEventListener('keydown', handler) return () => window.removeEventListener('keydown', handler) + // statusFilter is included so Enter dispatches the correct bulk action + // (approve vs restore) even if the device list doesn't change on switch. // eslint-disable-next-line react-hooks/exhaustive-deps - }, [open, selectMode, selectedIds, filtered]) + }, [open, selectMode, selectedIds, filtered, statusFilter]) return ( <> @@ -421,7 +423,6 @@ export function PendingDevicesModal({ open, onClose, highlightId, initialStatus render={