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
This commit is contained in:
Pouzor
2026-06-03 01:31:50 +02:00
parent 01fce64b2c
commit 6784b8f6be
@@ -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={
<button
className="text-muted-foreground hover:text-foreground p-1.5 rounded transition-colors"
title="Close"
aria-label="Close"
/>
}