Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

feat(timeline): move Clear timeline to the end of the toolbar behind a divider

EtienneLescotacb7f71e77d1
diff --git a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx
index d6d3345e5..601bd1abc 100644
--- a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx
+++ b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx
@@ -431,9 +431,30 @@ describe("V4Timeline create-from-toolbar", () => {
trimRanges: { id: "r1", assetId: "a1", clipId: "c@0", startSec: 1, endSec: 3 },
};
- it("shows no Clear timeline button while every edit lane is empty", () => {
+ const toolbarOf = () => screen.getByRole("toolbar", { name: "toolbar.timelineTools" });
+ const dividersIn = (toolbar: HTMLElement) =>
+ Array.from(toolbar.querySelectorAll("[class*=tlToolSep]"));
+
+ it("shows no Clear timeline button while every edit lane is empty, and no divider for it", () => {
renderTimeline(undefined, undefined, undefined, undefined, { annotationRegions: [] });
expect(screen.queryByLabelText("buttons.clearTimeline")).not.toBeInTheDocument();
+ // Only the divider after the auto-enhance button: none is left dangling at the end.
+ expect(dividersIn(toolbarOf())).toHaveLength(1);
+ });
+
+ it("puts Clear timeline last, behind a divider, after the Add Full Camera button", () => {
+ renderTimeline();
+ const toolbar = toolbarOf();
+ const buttons = Array.from(toolbar.querySelectorAll("button"));
+ const clear = screen.getByLabelText("buttons.clearTimeline");
+ expect(buttons.at(-1)).toBe(clear);
+
+ const divider = clear.previousElementSibling;
+ expect(divider?.className).toContain("tlToolSep");
+ expect(divider?.previousElementSibling).toBe(
+ screen.getByLabelText("buttons.addCameraFullscreen"),
+ );
+ expect(dividersIn(toolbar)).toHaveLength(2);
});
it.each(
diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsx
index 20bbf87db..5ac0be39f 100644
--- a/src/components/ai-edition/v4/V4Timeline.tsx
+++ b/src/components/ai-edition/v4/V4Timeline.tsx
@@ -1997,20 +1997,6 @@ export function V4Timeline({
<Crosshair size={16} />
</button>
</Tooltip>
- {/* Absent, not greyed out, when there is nothing to clear. One write in the
- store, so one Ctrl+Z restores every region. */}
- {hasEditRegions ? (
- <Tooltip content={t("buttons.clearTimeline")}>
- <button
- type="button"
- className={styles.tlToolBtn}
- aria-label={t("buttons.clearTimeline")}
- onClick={() => void tl.clearTimeline()}
- >
- <Eraser size={16} />
- </button>
- </Tooltip>
- ) : null}
<Tooltip content={t("buttons.addCameraFullscreen")}>
<button
type="button"
@@ -2023,6 +2009,25 @@ export function V4Timeline({
<Maximize2 size={16} />
</button>
</Tooltip>
+ {/* Last, behind a divider: every button before it adds a region, this one
+ clears them. Absent with its divider, not greyed out, when there is
+ nothing to clear. One write in the store, so one Ctrl+Z restores every
+ region. */}
+ {hasEditRegions ? (
+ <>
+ <span className={styles.tlToolSep} aria-hidden />
+ <Tooltip content={t("buttons.clearTimeline")}>
+ <button
+ type="button"
+ className={styles.tlToolBtn}
+ aria-label={t("buttons.clearTimeline")}
+ onClick={() => void tl.clearTimeline()}
+ >
+ <Eraser size={16} />
+ </button>
+ </Tooltip>
+ </>
+ ) : null}
</div>
</TooltipProvider>
) : (
diff --git a/technical-documentation/testing/manual-e2e-checklist.md b/technical-documentation/testing/manual-e2e-checklist.md
index 55ff689de..4a50c714c 100644
--- a/technical-documentation/testing/manual-e2e-checklist.md
+++ b/technical-documentation/testing/manual-e2e-checklist.md
@@ -295,7 +295,7 @@ The timeline toolbar adds each kind: *Add zoom (Z)*, *Add trim (T)*, *Add speed
- [ ] Set a zoom region's *Focus mode* to Auto and confirm its focus follows cursor telemetry across the whole region.
- [ ] Use *Auto-enhance* → *Automatic zooms* and confirm it adds suggested zoom regions when cursor telemetry supports suggestions, or says why not ("No room for automatic zooms" on a take whose zooms were already placed after recording).
- [ ] Select a zoom region and activate *Delete zoom* in the inspector; confirm it disappears from the lane.
-- [ ] With a zoom, a speed, a trim, an annotation and a Full Camera region on the timeline, plus an imported audio track and captions, activate *Clear timeline* (the eraser button after *Auto-Focus all zooms*, absent while no region exists) and confirm every region disappears in one step while the clips, the audio track and the captions stay, and one `Ctrl+Z` brings all the regions back.
+- [ ] With a zoom, a speed, a trim, an annotation and a Full Camera region on the timeline, plus an imported audio track and captions, activate *Clear timeline* (the eraser button at the end of the toolbar, after *Add Full Camera (C)* and a divider; both are absent while no region exists) and confirm every region disappears in one step while the clips, the audio track and the captions stay, and one `Ctrl+Z` brings all the regions back.
- [ ] Activate *Add speed (S)* and confirm a speed region appears.
- [ ] Pick each speed in the *Playback speed* row (0.5×, 1×, 1.5×, 2×, 4×) and confirm the lane label and preview timing change.
- [ ] Enter a custom speed in the *Custom speed* field, commit it, and confirm the value is kept, with no preset pressed.