mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-22 03:05:32 +02:00
frontend: Esc deselects entry; group font artifacts in rail
This commit is contained in:
parent
3407122303
commit
a4de506495
8 changed files with 141 additions and 73 deletions
|
|
@ -464,6 +464,23 @@ export default function App() {
|
|||
setPreviewEntryUid(null)
|
||||
}, [selectedEntry])
|
||||
|
||||
// Esc: deselect current entry/entries, unless a modal or input has focus.
|
||||
useEffect(() => {
|
||||
const handler = (e) => {
|
||||
if (e.key !== 'Escape') return
|
||||
if (captureDialogOpen || previewEntryUid) return
|
||||
const tag = document.activeElement?.tagName
|
||||
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return
|
||||
if (selectedUids.size > 0) {
|
||||
e.preventDefault()
|
||||
setSelectedUids(new Set())
|
||||
document.activeElement?.blur?.()
|
||||
}
|
||||
}
|
||||
window.addEventListener('keydown', handler)
|
||||
return () => window.removeEventListener('keydown', handler)
|
||||
}, [captureDialogOpen, previewEntryUid, selectedUids])
|
||||
|
||||
// Toggle body class so fixed AudioBar doesn't obscure scrollable content
|
||||
useEffect(() => {
|
||||
document.body.classList.toggle('has-audio-bar', !!currentAudio)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue