fix(frontend): make Escape dismiss overlays before clearing selection
deploy / deploy (push) Successful in 18s
deploy / deploy (push) Successful in 18s
Escape now peels one layer at a time on the files page: an open tag editor, pool picker, or delete confirm closes first, and only a second Escape drops the multi-select. Selection-exit handling moves out of SelectionBar into a single window handler on the page so precedence is deterministic rather than dependent on window-listener fire order. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,18 @@
|
||||
// ---- Bulk tag editor ----
|
||||
let tagEditorOpen = $state(false);
|
||||
|
||||
// Escape dismisses one layer at a time: an open overlay (tag editor / pool
|
||||
// picker / delete confirm) first, then the selection. The file viewer owns
|
||||
// its own Escape, so we bail out while it's up.
|
||||
function handleEscape(e: KeyboardEvent) {
|
||||
if (e.key !== 'Escape') return;
|
||||
if (tagEditorOpen) tagEditorOpen = false;
|
||||
else if (poolPickerOpen) poolPickerOpen = false;
|
||||
else if (confirmDeleteFiles) confirmDeleteFiles = false;
|
||||
else if (activeFileId) return;
|
||||
else if ($selectionActive) selectionStore.exit();
|
||||
}
|
||||
|
||||
// ---- Add to pool picker ----
|
||||
let poolPickerOpen = $state(false);
|
||||
let pools = $state<Pool[]>([]);
|
||||
@@ -455,6 +467,8 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:window onkeydown={handleEscape} />
|
||||
|
||||
<svelte:head>
|
||||
<title>Files | Tanabata</title>
|
||||
</svelte:head>
|
||||
|
||||
Reference in New Issue
Block a user