Skip to content

Modern Docker Management, Designed for Everyone

feat: middle-click to close editor tabs and Ctrl/Cmd+S to save projects (#4333)

DominikZublasinga7f16c964691
diff --git a/frontend/src/lib/components/editor-tab-strip.svelte b/frontend/src/lib/components/editor-tab-strip.svelte
index bd4a32b47..d933f35d0 100644
--- a/frontend/src/lib/components/editor-tab-strip.svelte
+++ b/frontend/src/lib/components/editor-tab-strip.svelte
@@ -22,6 +22,17 @@
}
let { tabs, activeKey, onSelect, onClose, actions }: Props = $props();
+
+ // Middle-click closes like browser and IDE tabs; preventing mousedown stops Windows auto-scroll.
+ function preventMiddleMouseDown(event: MouseEvent) {
+ if (event.button === 1) event.preventDefault();
+ }
+
+ function closeOnMiddleClick(event: MouseEvent, key: string) {
+ if (event.button !== 1) return;
+ event.preventDefault();
+ onClose(key);
+ }
</script>
<div class="flex h-9 shrink-0 items-center border-b border-border bg-muted/30">
@@ -47,6 +58,8 @@
)}
title={tab.title}
onclick={() => onSelect(tab.key)}
+ onmousedown={preventMiddleMouseDown}
+ onauxclick={(event) => closeOnMiddleClick(event, tab.key)}
>
<FileTextIcon class={cn('size-3.5 shrink-0', tab.iconClass)} />
<span class="max-w-40 truncate">{tab.label}</span>
@@ -67,6 +80,8 @@
)}
aria-label={m.common_close()}
onclick={() => onClose(tab.key)}
+ onmousedown={preventMiddleMouseDown}
+ onauxclick={(event) => closeOnMiddleClick(event, tab.key)}
>
<CloseIcon class="size-3" />
</button>
diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
index 32ba5b6a6..c69409688 100644
--- a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
@@ -72,7 +72,7 @@
import { getStatusVariant, getThemedIconUrl } from '#lib/utils/docker.js';
import { capitalizeFirstLetter } from '#lib/utils/formatting.js';
import { gitOpsComposeEditUrl, gitOpsFileEditUrl, gitOpsProjectUrl } from '#lib/utils/gitops.js';
- import { toGitRouteUrl, toSafeHref } from '#lib/utils/navigation.js';
+ import { matchesShortcutEvent, toGitRouteUrl, toSafeHref } from '#lib/utils/navigation.js';
import { createForm } from '#lib/utils/settings.svelte.js';
import { globalVariablesToMap } from '#lib/utils/template-load.js';
import { tryCatch } from '#lib/utils/try-catch.js';
@@ -814,6 +814,13 @@
}
}
+ // Always swallow Ctrl/Cmd+S here so the browser's "save page" dialog never opens.
+ function handleSaveShortcut(event: KeyboardEvent) {
+ if (!matchesShortcutEvent(['mod', 's'], event)) return;
+ event.preventDefault();
+ if (canSave && !isLoading.saving) handleSaveChanges();
+ }
+
function saveNameIfChanged() {
if (project?.isArchived) return;
if (effectiveName === serverName) return;
@@ -1471,6 +1478,8 @@
});
</script>
+<svelte:window onkeydown={handleSaveShortcut} />
+
{#snippet projectComposeTab(project: Project)}
<Tabs.Content value="compose" class="h-full min-h-0">
<div class="flex h-full min-h-0 flex-col">
diff --git a/frontend/src/routes/(app)/projects/new/+page.svelte b/frontend/src/routes/(app)/projects/new/+page.svelte
index 9c9b87795..b5663ebb3 100644
--- a/frontend/src/routes/(app)/projects/new/+page.svelte
+++ b/frontend/src/routes/(app)/projects/new/+page.svelte
@@ -40,6 +40,7 @@
templateNameSlug,
type ProjectEditorLayoutMode
} from '#lib/utils/compose-flow.js';
+ import { matchesShortcutEvent } from '#lib/utils/navigation.js';
import { preventDefault, createForm } from '#lib/utils/settings.svelte.js';
import {
getTemplateEditorValidationState,
@@ -179,6 +180,14 @@
// effective name without writing to form state reactively.
const effectiveName = $derived(composeYamlName ?? inputs.name.value);
const createMenuBusy = $derived(ui.saving || ui.converting || ui.isLoadingTemplateContent);
+ const createDisabled = $derived(!effectiveName || !inputs.composeContent.value || hasEditorErrors || createMenuBusy);
+
+ // Always swallow Ctrl/Cmd+S here so the browser's "save page" dialog never opens.
+ function handleCreateShortcut(event: KeyboardEvent) {
+ if (!matchesShortcutEvent(['mod', 's'], event)) return;
+ event.preventDefault();
+ if (canCreateProject && !createDisabled) handleSubmit();
+ }
async function handleSubmit() {
if (sourceContainerIds.length > 0 && canDeleteContainers) {
@@ -261,6 +270,8 @@
}
</script>
+<svelte:window onkeydown={handleCreateShortcut} />
+
{#snippet newProjectWorkspaceEditor()}
{#key activeProjectTab}
{#if activeProjectTab === 'compose'}
@@ -359,7 +370,7 @@
tooltipDescription={m.compose_project_name_tooltip_description()}
tooltipExample={m.compose_project_name_tooltip_example()}
showCreateButton={!hasEditorErrors && canCreateProject}
- createDisabled={!effectiveName || !inputs.composeContent.value || hasEditorErrors || createMenuBusy}
+ {createDisabled}
createLoading={ui.saving}
createLabel={m.compose_create_project()}
createLoadingLabel={m.common_action_creating()}