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:
@@ -383,8 +383,10 @@ export function PendingDevicesModal({ open, onClose, highlightId, initialStatus
|
|||||||
}
|
}
|
||||||
window.addEventListener('keydown', handler)
|
window.addEventListener('keydown', handler)
|
||||||
return () => window.removeEventListener('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
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [open, selectMode, selectedIds, filtered])
|
}, [open, selectMode, selectedIds, filtered, statusFilter])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -421,7 +423,6 @@ export function PendingDevicesModal({ open, onClose, highlightId, initialStatus
|
|||||||
render={
|
render={
|
||||||
<button
|
<button
|
||||||
className="text-muted-foreground hover:text-foreground p-1.5 rounded transition-colors"
|
className="text-muted-foreground hover:text-foreground p-1.5 rounded transition-colors"
|
||||||
title="Close"
|
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user