Skip to content

Write HTML. Render video. Built for agents.

fix(studio): give the group row's caret the panel's glyph and size back (#3415)

Vance Ingallsc59402389555
diff --git a/packages/studio/src/player/components/TimelineGroupHeader.test.tsx b/packages/studio/src/player/components/TimelineGroupHeader.test.tsx
new file mode 100644
index 0000000000..41546eb374
--- /dev/null
+++ b/packages/studio/src/player/components/TimelineGroupHeader.test.tsx
@@ -0,0 +1,76 @@
+// @vitest-environment happy-dom
+
+import React, { act } from "react";
+import { createRoot } from "react-dom/client";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { TimelineGroupHeader } from "./TimelineGroupHeader";
+import { defaultTimelineTheme } from "./timelineTheme";
+
+(globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+
+function renderHeader(
+ overrides: Partial<React.ComponentProps<typeof TimelineGroupHeader>> = {},
+): HTMLElement {
+ const host = document.createElement("div");
+ document.body.append(host);
+ act(() => {
+ createRoot(host).render(
+ <TimelineGroupHeader
+ label="Voiceover"
+ memberCount={5}
+ isExpanded={false}
+ onToggleExpanded={vi.fn()}
+ laneCount={0}
+ isLaneOpen={false}
+ onToggleLanes={vi.fn()}
+ hidden={false}
+ onToggleHidden={vi.fn()}
+ isSoloed={false}
+ isHalfLitSolo={false}
+ onToggleSolo={vi.fn()}
+ onFxChainChange={vi.fn()}
+ onOpenFxRack={vi.fn()}
+ columnWidth={220}
+ theme={defaultTimelineTheme}
+ {...overrides}
+ />,
+ );
+ });
+ return host;
+}
+
+/** The structural disclosure — the caret, not the `∿` lane toggle. */
+function caret(host: HTMLElement): HTMLButtonElement {
+ const el = Array.from(host.querySelectorAll("button")).find((b) =>
+ b.getAttribute("aria-label")?.includes("tracks"),
+ );
+ if (!el) throw new Error("no disclosure caret");
+ return el as HTMLButtonElement;
+}
+
+afterEach(() => {
+ document.body.innerHTML = "";
+});
+
+describe("TimelineGroupHeader disclosure caret", () => {
+ // Guards a regression that shipped once: the caret silently reverted to a
+ // smaller, non-mono, rotated glyph unlike the property panel's carets.
+ it("swaps the glyph rather than rotating one", () => {
+ expect(caret(renderHeader({ isExpanded: false })).textContent).toContain("▸");
+ expect(caret(renderHeader({ isExpanded: true })).textContent).toContain("▾");
+ });
+
+ it("does not rotate the glyph", () => {
+ const glyph = caret(renderHeader({ isExpanded: true })).querySelector("span");
+ expect(glyph?.getAttribute("style") ?? "").not.toContain("rotate");
+ });
+
+ it("keeps the caret mono at 13px, not back down at the 11px the row inherits", () => {
+ // Only this component's own className — the panel carets are not read here,
+ // and this does not claim to pin a match against them.
+ const className = caret(renderHeader()).className;
+ expect(className).toContain("font-mono");
+ expect(className).toContain("text-[13px]");
+ expect(className).not.toContain("text-[11px]");
+ });
+});
diff --git a/packages/studio/src/player/components/TimelineGroupHeader.tsx b/packages/studio/src/player/components/TimelineGroupHeader.tsx
index c579bc28f9..b28994b310 100644
--- a/packages/studio/src/player/components/TimelineGroupHeader.tsx
+++ b/packages/studio/src/player/components/TimelineGroupHeader.tsx
@@ -77,7 +77,11 @@ export function TimelineGroupHeader({
aria-expanded={isExpanded}
aria-label={`${isExpanded ? "Hide" : "Show"} ${label} tracks`}
title={`${isExpanded ? "Hide" : "Show"} tracks`}
- className={`flex h-6 w-6 shrink-0 items-center justify-center rounded border-0 bg-transparent p-0 text-[11px] focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC] ${
+ // Mono, like both of the property panel's disclosure carets. The size is
+ // this row's own call and not a match to either of them: the node-body
+ // caret sits under `text-[9px]`, and `hf-fx-preset-run-caret` has no
+ // size rule at all, so there is no measured target to match.
+ className={`flex h-6 w-6 shrink-0 items-center justify-center rounded border-0 bg-transparent p-0 font-mono text-[13px] focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC] ${
isExpanded ? "text-white" : "text-white/55 hover:text-white"
}`}
onPointerDown={(event) => event.stopPropagation()}
@@ -86,9 +90,9 @@ export function TimelineGroupHeader({
onToggleExpanded();
}}
>
- <span aria-hidden="true" style={{ transform: isExpanded ? "rotate(90deg)" : undefined }}>
- ▸
- </span>
+ {/* Swapped, not rotated: both panel carets swap, and a rotated ▸ sits
+ off-centre in its box because the glyph is not square. */}
+ <span aria-hidden="true">{isExpanded ? "▾" : "▸"}</span>
</button>
<span aria-hidden="true" className="shrink-0 text-[12px] leading-none text-white/50">
▤