From 37296128e07a1810c00a5a6130074f3fc3269c79 Mon Sep 17 00:00:00 2001 From: Danny White <3104761+dnywh@users.noreply.github.com> Date: Mon, 20 Jul 2026 18:00:24 -0400 Subject: [PATCH] fix(studio): untangle nested buttons in editor tabs (#48101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What kind of change does this PR introduce? A11y markup + keyboard close for editor tabs (Table Editor open tables / SQL Editor snippets). ## What is the current behavior? Editor tabs nest interactive elements (already in prod): 1. Sortable shell spreads dnd-kit `attributes` → `div role="button" tabindex="0"` 2. Inner `TabsTrigger` → real ` + {index < openTabs.length && (
)} diff --git a/apps/studio/components/layouts/Tabs/Tabs.tsx b/apps/studio/components/layouts/Tabs/Tabs.tsx index c1959e98717..72b06e913ac 100644 --- a/apps/studio/components/layouts/Tabs/Tabs.tsx +++ b/apps/studio/components/layouts/Tabs/Tabs.tsx @@ -214,27 +214,40 @@ export const EditorTabs = () => { {/* Non-draggable new tab */} {hasNewTab && ( - - -
- New -
- + { + if (e.key !== 'Delete' && e.key !== 'Backspace') return + e.preventDefault() + e.stopPropagation() + handleClose('new') + }} + className={cn( + 'flex items-center gap-2 px-3 text-xs', + 'bg-dash-sidebar/50 dark:bg-surface-100/50', + 'data-[state=active]:bg-dash-sidebar dark:data-[state=active]:bg-surface-100', + 'relative group h-full border-t-2 border-b-0!', + 'hover:bg-surface-300 dark:hover:bg-surface-100' + )} + > + +
+ New +
+ {/* Reserve close-icon width; close is a sibling overlay. */} + +
+ + +
)}