Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/studio/src/player/components/LayerDisclosureRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ export function LayerDisclosureRow({
<span aria-hidden="true" className="shrink-0 text-[13px] leading-none text-white/40">
◇
</span>
{/* Wraps rather than truncating: a truncated name needs a hover to be
read, which a scanned column cannot rely on. */}
<span className="min-w-0 flex-1 wrap-break-word font-medium leading-tight">{name}</span>
<span title={name} className="min-w-0 flex-1 truncate font-medium leading-tight">
{name}
</span>
<TrackClipCount clipCount={clipCount} />
{children}
{/* Anchored right, on every header that has one: the lane toggle is the
Expand Down
10 changes: 4 additions & 6 deletions packages/studio/src/player/components/TimelineGroupHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ function GroupNameButton({
<span aria-hidden="true" className="shrink-0 text-[12px] leading-none text-white/50">
▤
</span>
{/* Wraps rather than truncating — a name that needs a hover to be read
is no use in a column you scan. */}
<span className="min-w-0 wrap-break-word text-left font-medium leading-tight">{label}</span>
<span title={label} className="min-w-0 truncate text-left font-medium leading-tight">
{label}
</span>
<span
className="shrink-0 rounded-full bg-white/10 px-1 text-[9px] leading-[14px] tabular-nums text-white/55"
aria-hidden="true"
Expand Down Expand Up @@ -109,9 +109,7 @@ export function TimelineGroupHeader({
}}
>
{/* One line, like a track header's: caret and name, then every control
anchored to the right edge. The name wraps and the controls are
`shrink-0`, so they hold the edge and the name gives way — no second
line needed to keep five controls off the label. */}
anchored to the right edge. */}
<button
type="button"
tabIndex={-1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,14 @@ describe("PlainTrackHeader", () => {
expect(labelOf(view.host)).toBe("Hide track 1");
view.unmount();
});

it("truncates long names and keeps the full name in the tooltip", () => {
const name = "A-very-long-unbroken-clip-name-for-the-timeline";
const view = renderHeader({ trackLabel: name });
const label = view.host.querySelector("span[title]");
expect(label?.className).toContain("truncate");
expect(label?.className).not.toContain("wrap-break-word");
expect(label?.getAttribute("title")).toBe(name);
view.unmount();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,11 @@ export function PlainTrackHeader({
)}
{/* No `flex-1`: the name takes only the width it needs, so the clip
count sits against it rather than being pushed out to meet the
controls. The slack goes to the `ml-auto` group below instead.

Wraps rather than truncating: a truncated name needs a hover to be
read at all, and a tooltip is no use to a name you are scanning a
column of. `wrap-break-word` so a long single token breaks instead of
forcing the column wider. */}
controls. The slack goes to the `ml-auto` group below instead. */}
{showTrackLabel && (
<span className="min-w-0 wrap-break-word text-[11px] leading-tight">{trackLabel}</span>
<span title={trackLabel} className="min-w-0 truncate text-[11px] leading-tight">
{trackLabel}
</span>
)}
{showTrackLabel && <TrackClipCount clipCount={clipCount} />}
{/* `ml-auto` is what anchors the group right: it absorbs the slack the
Expand Down
Loading