Skip to content

Automate browser based workflows with AI

fix(SKY-11885/11887/11888): block header cosmetic polish (#7110)

Celal Zamanoğluf78ad441fca8
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.test.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.test.tsx
new file mode 100644
index 000000000..caf363ea5
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.test.tsx
@@ -0,0 +1,60 @@
+// @vitest-environment jsdom
+
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, test } from "vitest";
+
+import { EditableNodeTitle } from "./EditableNodeTitle";
+
+afterEach(() => {
+ cleanup();
+});
+
+describe("EditableNodeTitle edit-mode input sizing", () => {
+ test("caps the resizing input at its container width so a long label can't overflow into siblings", () => {
+ const longValue =
+ "This is a deliberately long block label used to reproduce the input overflow bug";
+ render(
+ <EditableNodeTitle value={longValue} editable onChange={() => {}} />,
+ );
+
+ fireEvent.click(screen.getByText(longValue));
+
+ const input = screen.getByDisplayValue(longValue);
+ expect(input.className).toContain("max-w-full");
+ });
+
+ test("still applies caller padding classes alongside the width cap", () => {
+ render(
+ <EditableNodeTitle
+ value="Set page URL"
+ editable
+ onChange={() => {}}
+ inputClassName="px-2 text-base"
+ />,
+ );
+
+ fireEvent.click(screen.getByText("Set page URL"));
+
+ const input = screen.getByDisplayValue("Set page URL");
+ expect(input.className).toContain("max-w-full");
+ expect(input.className).toContain("px-2");
+ });
+
+ test("passes through a relative/left offset alongside padding, for callers that align edit-mode text without shrinking their own auto-width column via margin", () => {
+ render(
+ <EditableNodeTitle
+ value="block_1"
+ editable
+ onChange={() => {}}
+ inputClassName="relative -left-1 px-1 text-base"
+ />,
+ );
+
+ fireEvent.click(screen.getByText("block_1"));
+
+ const input = screen.getByDisplayValue("block_1");
+ expect(input.className).toContain("relative");
+ expect(input.className).toContain("-left-1");
+ expect(input.className).toContain("px-1");
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.tsx
index 985b58b50..429f90752 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/components/EditableNodeTitle.tsx
@@ -65,7 +65,9 @@ function EditableNodeTitle({
disabled={!editable}
size={1}
autoFocus
- className={cn("nopan w-min border-0 p-0", inputClassName)}
+ // HorizontallyResizingInput sets an inline pixel width with no
+ // ceiling; max-w-full caps it at the row's allotted space.
+ className={cn("nopan w-min max-w-full border-0 p-0", inputClassName)}
onBlur={(event) => {
if (!editable) {
event.currentTarget.value = value;
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.test.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.test.tsx
new file mode 100644
index 000000000..df7b0e1d3
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.test.tsx
@@ -0,0 +1,106 @@
+// @vitest-environment jsdom
+
+import type { ComponentProps } from "react";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, test } from "vitest";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { MemoryRouter, Route, Routes } from "react-router-dom";
+import { ReactFlowProvider } from "@xyflow/react";
+import { PostHogContext } from "posthog-js/react";
+import type { PostHog } from "posthog-js";
+
+import { BlockActionContext } from "@/store/BlockActionContext";
+import { DebugStoreProvider } from "@/store/DebugStoreContext";
+
+import { NodeHeader } from "./NodeHeader";
+
+afterEach(() => {
+ cleanup();
+});
+
+const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+});
+
+// isFeatureEnabled/onFeatureFlags are the only members useWorkflowStudioEnabled
+// touches; a real PostHogProvider would fire network requests jsdom can't make.
+const fakePostHogClient = {
+ isFeatureEnabled: () => false,
+ onFeatureFlags: () => () => {},
+ featureFlags: { hasLoadedFlags: true },
+} as unknown as PostHog;
+
+const blockActionStub = {
+ requestDeleteNodeCallback: () => {},
+ duplicateNodeCallback: () => {},
+ transmuteNodeCallback: () => {},
+ toggleScriptForNodeCallback: () => {},
+};
+
+function renderNodeHeader(props: Partial<ComponentProps<typeof NodeHeader>>) {
+ return render(
+ <QueryClientProvider client={queryClient}>
+ <PostHogContext.Provider
+ value={{ client: fakePostHogClient, bootstrap: undefined }}
+ >
+ <MemoryRouter initialEntries={["/agents/wf-test/build"]}>
+ <Routes>
+ <Route
+ path="/agents/:workflowPermanentId/*"
+ element={
+ <ReactFlowProvider>
+ <BlockActionContext.Provider value={blockActionStub}>
+ <DebugStoreProvider>
+ <NodeHeader
+ blockLabel="block_1"
+ editable
+ nodeId="node-a"
+ totpIdentifier={null}
+ totpUrl={null}
+ type="code"
+ {...props}
+ />
+ </DebugStoreProvider>
+ </BlockActionContext.Provider>
+ </ReactFlowProvider>
+ }
+ />
+ </Routes>
+ </MemoryRouter>
+ </PostHogContext.Provider>
+ </QueryClientProvider>,
+ );
+}
+
+// jsdom has no layout engine: these tests can only pin the classes that
+// carry the fix, not the actual squeeze/drift/clip behavior they prevent.
+// That's verified against the real rendered component in a Chromium
+// harness (see the PR description for the before/after screenshots).
+describe("NodeHeader icon/title regressions (SKY-11885 / SKY-11887)", () => {
+ test("icon wrapper has shrink-0 so a long title column can't compress it", () => {
+ const { container } = renderNodeHeader({});
+ const iconWrapper = container.querySelector(".border-slate-600");
+ expect(iconWrapper?.className).toContain("shrink-0");
+ });
+
+ test("does not apply a code-specific icon scale", () => {
+ const { container } = renderNodeHeader({ type: "code" });
+ const svg = container.querySelector(".border-slate-600 svg");
+ expect(svg?.getAttribute("class") ?? "").not.toContain("scale-90");
+ });
+
+ test("display title carries no horizontal padding that would drift it from the subtitle", () => {
+ renderNodeHeader({ blockLabel: "block_1" });
+ const title = screen.getByText("block_1");
+ expect(title.className).not.toContain("px-2");
+ });
+
+ test("edit-mode input offsets its padding via relative/left, not a margin that would shrink the auto-width column", () => {
+ renderNodeHeader({ blockLabel: "block_1" });
+ fireEvent.click(screen.getByText("block_1"));
+ const input = screen.getByDisplayValue("block_1");
+ expect(input.className).toContain("relative");
+ expect(input.className).toContain("-left-1");
+ expect(input.className).not.toMatch(/-mx-/);
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
index 97260baac..b9e2f5694 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
@@ -968,7 +968,9 @@ function NodeHeader({
) : (
gripHandle
))}
- <div className="flex h-[2.75rem] w-[2.75rem] items-center justify-center rounded border border-slate-600">
+ <div className="flex h-[2.75rem] w-[2.75rem] shrink-0 items-center justify-center rounded border border-slate-600">
+ {/* Without shrink-0, a long label or subtitle in the sibling
+ column steals width from this box before its own min-content. */}
<WorkflowBlockIcon workflowBlockType={type} className="size-6" />
</div>
<div className="flex min-w-0 flex-col gap-1">
@@ -977,7 +979,10 @@ function NodeHeader({
editable={editable}
onChange={setLabel}
titleClassName="text-base"
- inputClassName="text-base"
+ // A negative margin here would shrink this auto-width column's
+ // measured size and clip short values via max-w-full, so the
+ // padding is offset with relative/left (paint-only) instead.
+ inputClassName="relative -left-1 px-1 text-base"
/>
<div className="flex items-center gap-2">