Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(plan): correct tab hover and menu spacing (#21499)

boojackf7fdaa20ac09
diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailChangesBranch.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailChangesBranch.tsx
index 035eaa6714..c7193cf12a 100644
--- a/frontend/src/routes/project/plan-detail/components/PlanDetailChangesBranch.tsx
+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailChangesBranch.tsx
@@ -161,12 +161,6 @@ const DEFAULT_VISIBLE_TARGETS = 20;
const DATABASE_GROUP_VISIBLE_DATABASES = 3;
const EMPTY_SELECT_VALUE = "__empty__";
-// Shared hover/focus recipe for the square icon buttons on the tab strip
-// (the per-tab actions menu and the add-change button). Callers append their
-// own size and corner radius.
-const ICON_ACTION_CLASS =
- "inline-flex cursor-pointer items-center justify-center text-control-light outline-hidden transition-colors hover:bg-control-bg hover:text-control focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50";
-
const pushSpecDetailRoute = (
projectId: string,
planId: string,
@@ -315,6 +309,10 @@ export function PlanDetailChangesBranch({
const selectSpec = useCallback(
(specId: string) => {
+ if (specId === pendingNewSpec?.id) {
+ setIsPendingSelected(true);
+ return;
+ }
if (page.isCreating) {
// No URL drives the selection during plan creation.
onSelectedSpecIdChange(specId);
@@ -325,7 +323,13 @@ export function PlanDetailChangesBranch({
// confirm dialog when the navigation is cancelled.
void pushSpecDetailRoute(page.projectId, page.planId, specId);
},
- [onSelectedSpecIdChange, page.isCreating, page.planId, page.projectId]
+ [
+ onSelectedSpecIdChange,
+ page.isCreating,
+ page.planId,
+ page.projectId,
+ pendingNewSpec?.id,
+ ]
);
const handleSpecCreate = async (targets: string[]) => {
@@ -587,10 +591,7 @@ export function PlanDetailChangesBranch({
>
<Button
aria-label={t("plan.add-spec")}
- className={cn(
- ICON_ACTION_CLASS,
- "rounded-xs [touch-action:manipulation]"
- )}
+ className="text-control-light hover:text-control [touch-action:manipulation]"
disabled={Boolean(pendingNewSpec)}
onClick={() => setShowAddSpecSheet(true)}
size="sm"
@@ -621,9 +622,7 @@ export function PlanDetailChangesBranch({
action={
canModifySpecs && visibleSpecs.length > 1 ? (
<DropdownMenu>
- <DropdownMenuTrigger
- className={cn(ICON_ACTION_CLASS, "size-6 rounded-xs")}
- >
+ <DropdownMenuTrigger className="inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-xs text-control-light outline-hidden transition-colors hover:bg-control-bg hover:text-control focus-visible:ring-2 focus-visible:ring-accent">
<EllipsisVertical className="size-3.5" />
</DropdownMenuTrigger>
<DropdownMenuContent>
@@ -646,26 +645,12 @@ export function PlanDetailChangesBranch({
</DropdownMenu>
) : undefined
}
- onSelect={() => {
- if (isPending) {
- // Draft has no backend URL — only update local selection.
- setIsPendingSelected(true);
- return;
- }
- // Don't clear isPendingSelected here — if a leave-confirm
- // dialog intercepts the navigation, we want the draft to
- // stay visible behind the dialog. The URL-sync effect
- // below clears it once selectedSpecId actually changes.
- selectSpec(spec.id);
- }}
+ onSelect={() => selectSpec(spec.id)}
selected={isSelected}
>
<PlanChangeReference
ariaHidden
- className={cn(
- "text-sm font-medium transition-colors",
- isSelected ? "" : "text-control-light hover:text-control"
- )}
+ className={isSelected ? undefined : "text-control-light"}
density="tab"
reference={reference}
/>
diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailTabStrip.test.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailTabStrip.test.tsx
index f365c49611..7a1c43f475 100644
--- a/frontend/src/routes/project/plan-detail/components/PlanDetailTabStrip.test.tsx
+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailTabStrip.test.tsx
@@ -38,7 +38,10 @@ describe("PlanDetailTabItem", () => {
const tab = container.firstElementChild;
const button = tab?.querySelector("button");
- expect(tab).toHaveClass("min-w-40", "max-w-64");
+ expect(tab).toHaveClass(
+ "min-w-[min(10rem,100%)]",
+ "max-w-[min(16rem,100%)]"
+ );
expect(button).toHaveClass("min-w-0", "flex-1");
expect(button).not.toHaveClass("w-full");
});
diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailTabStrip.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailTabStrip.tsx
index 7f918c8540..a6a7157bea 100644
--- a/frontend/src/routes/project/plan-detail/components/PlanDetailTabStrip.tsx
+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailTabStrip.tsx
@@ -14,25 +14,19 @@ export function PlanDetailTabStrip({
return (
<div className="relative bg-background pt-3">
<div className="absolute bottom-0 w-full border-b border-b-block-border leading-0" />
- <div className="flex items-center justify-between gap-x-4">
+ <div className="flex min-w-0 items-center gap-x-2">
<div
className={cn(
"flex min-w-0 items-center overflow-x-auto",
- // With a trailing slot the container shrinks to its tabs so the
- // sticky button sits right after the last tab (and pins to the
- // edge on overflow); the occluder below supplies the right
- // padding. Otherwise fill the row with symmetric padding.
trailing ? "pl-4" : "flex-1 px-4"
)}
>
{children}
- {trailing && (
- <div className="sticky right-0 ml-1 flex shrink-0 items-center self-stretch border-b border-b-block-border bg-background pr-4 pl-2">
- {trailing}
- </div>
- )}
</div>
- {action && <div className="shrink-0 px-4">{action}</div>}
+ {trailing && (
+ <div className="flex shrink-0 items-center pr-4">{trailing}</div>
+ )}
+ {action && <div className="ml-auto shrink-0 px-4">{action}</div>}
</div>
</div>
);
@@ -59,10 +53,11 @@ export function PlanDetailTabItem({
// No transition here: the tab body swaps in the same commit, so a
// color fade makes the highlight lag the content and read as flicker.
"relative flex shrink-0 items-center rounded-t-sm border",
- boundedWidth && "min-w-40 max-w-64",
+ action && "gap-1 pr-1",
+ boundedWidth && "min-w-[min(10rem,100%)] max-w-[min(16rem,100%)]",
selected
? "border-block-border border-b-transparent bg-background"
- : "border-b-block-border border-transparent hover:opacity-80"
+ : "border-b-block-border border-transparent hover:bg-control-bg"
)}
>
<Button
@@ -70,18 +65,15 @@ export function PlanDetailTabItem({
size="md"
aria-label={accessibleLabel}
className={cn(
- "flex min-h-9 min-w-0 items-center justify-start gap-2 px-4 py-2 text-left",
- boundedWidth ? "flex-1" : "shrink-0"
+ "min-w-0 flex-1 justify-start rounded-t-sm text-left hover:bg-transparent focus-visible:ring-inset focus-visible:ring-offset-0",
+ action && "pr-0"
)}
onClick={onSelect}
type="button"
>
{children}
</Button>
- {action && (
- // Pulled into the label's right padding so it sits close to the text.
- <div className="-ml-3 mr-2 flex shrink-0 items-center">{action}</div>
- )}
+ {action}
</div>
);
}