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:
@@ -8,14 +8,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let { onEditTags, onAddToPool, onDelete }: Props = $props();
|
let { onEditTags, onAddToPool, onDelete }: Props = $props();
|
||||||
|
|
||||||
function handleKeydown(e: KeyboardEvent) {
|
|
||||||
if (e.key === 'Escape') selectionStore.exit();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window onkeydown={handleKeydown} />
|
|
||||||
|
|
||||||
<div class="bar" role="toolbar" aria-label="Selection actions">
|
<div class="bar" role="toolbar" aria-label="Selection actions">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Count / deselect all -->
|
<!-- Count / deselect all -->
|
||||||
|
|||||||
@@ -27,6 +27,18 @@
|
|||||||
// ---- Bulk tag editor ----
|
// ---- Bulk tag editor ----
|
||||||
let tagEditorOpen = $state(false);
|
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 ----
|
// ---- Add to pool picker ----
|
||||||
let poolPickerOpen = $state(false);
|
let poolPickerOpen = $state(false);
|
||||||
let pools = $state<Pool[]>([]);
|
let pools = $state<Pool[]>([]);
|
||||||
@@ -455,6 +467,8 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window onkeydown={handleEscape} />
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Files | Tanabata</title>
|
<title>Files | Tanabata</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|||||||
Reference in New Issue
Block a user