Skip to content

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

fix(editor): keep busy buttons hoverable and open Record mode tooltips above the pill

EtienneLescot188ea2f3d3e7
diff --git a/src/components/ai-edition/LeftPanel.tooltips.test.tsx b/src/components/ai-edition/LeftPanel.tooltips.test.tsx
index 3e919d5a5..9796e9b64 100644
--- a/src/components/ai-edition/LeftPanel.tooltips.test.tsx
+++ b/src/components/ai-edition/LeftPanel.tooltips.test.tsx
@@ -196,6 +196,18 @@ describe("ChatStripPanel tooltips", () => {
expect(tip.chip).toBe("Enter");
});
+ // While the title is being edited the button is greyed, but it stays hoverable and does nothing.
+ it("keeps Rename tooltip-able while the title is being edited", async () => {
+ sessions.list = oneSession;
+ renderPanel();
+ const rename = await screen.findByRole("button", { name: "chat.renameConversation" });
+ fireEvent.click(rename);
+ await screen.findByDisplayValue("Conversation 1");
+ expect(rename).toHaveAttribute("aria-disabled", "true");
+ expect(rename).not.toBeDisabled();
+ expect((await tooltipOn(rename)).text).toBe("chat.renameConversation");
+ });
+
it("keeps Compact tooltip-able while there is no conversation, and does nothing", async () => {
renderPanel();
const compact = await screen.findByRole("button", { name: "chat.compactContext" });
diff --git a/src/components/ai-edition/LeftPanel.tsx b/src/components/ai-edition/LeftPanel.tsx
index 1f5f8f544..82e809268 100644
--- a/src/components/ai-edition/LeftPanel.tsx
+++ b/src/components/ai-edition/LeftPanel.tsx
@@ -1169,8 +1169,9 @@ export function ChatStripPanel() {
<button
type="button"
aria-label={t("chat.renameConversation")}
- disabled={editingSessionId === activeSessionId}
+ aria-disabled={editingSessionId === activeSessionId || undefined}
onClick={() => {
+ if (editingSessionId === activeSessionId) return;
const current = sessions.find((s) => s.id === activeSessionId);
if (current) beginEditTitle(activeSessionId, current.title);
}}
diff --git a/src/components/ai-edition/v4/EditorShellV4.module.css b/src/components/ai-edition/v4/EditorShellV4.module.css
index 9f4710294..cae243f28 100644
--- a/src/components/ai-edition/v4/EditorShellV4.module.css
+++ b/src/components/ai-edition/v4/EditorShellV4.module.css
@@ -1351,6 +1351,11 @@
background: var(--surface-3);
color: var(--fg);
}
+/* Busy (Auto-enhance while a pass runs): still hoverable, so its tooltip opens. */
+.tlToolBtn[aria-disabled="true"] {
+ opacity: 0.55;
+ cursor: not-allowed;
+}
/* Toggle tools (Auto-Focus) read their lit state off aria-pressed, so the styling can't
drift from what assistive tech announces. */
.tlToolBtn[aria-pressed="true"] {
diff --git a/src/components/ai-edition/v4/MediaStage.regenerate.test.tsx b/src/components/ai-edition/v4/MediaStage.regenerate.test.tsx
new file mode 100644
index 000000000..35ed417ef
--- /dev/null
+++ b/src/components/ai-edition/v4/MediaStage.regenerate.test.tsx
@@ -0,0 +1,103 @@
+// @vitest-environment jsdom
+// The Regenerate button is a bare refresh icon beside a language list. While a transcription runs
+// it is greyed, but it stays focusable and hoverable so its tooltip still opens: a natively
+// disabled button takes neither, which is what `aria-disabled` is for.
+
+import "@testing-library/jest-dom";
+import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+const transcription = vi.hoisted(() => ({
+ status: "idle" as "idle" | "running",
+ request: vi.fn(),
+}));
+
+vi.mock("@/lib/ai-edition/store/transcriptionStore", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("@/lib/ai-edition/store/transcriptionStore")>();
+ return {
+ ...actual,
+ useAssetTranscriptions: () => ({
+ "asset-1": { assetId: "asset-1", status: transcription.status },
+ }),
+ useTranscriptionStore: (select: (state: { request: unknown }) => unknown) =>
+ select({ request: transcription.request }),
+ };
+});
+
+// An echoing translator: the assertions read against keys, not prose that drifts with copy edits.
+vi.mock("@/contexts/I18nContext", () => ({
+ useI18n: () => ({ locale: "en", setLocale: vi.fn() }),
+ useScopedT: () => (key: string) => key,
+}));
+
+vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.fn() } }));
+
+import { TooltipProvider } from "@/components/ui/tooltip";
+import { assetSchema, createEmptyDocument } from "@/lib/ai-edition/schema";
+import { useProjectStore } from "@/lib/ai-edition/store/projectStore";
+import { MediaStage } from "./MediaStage";
+
+class StubResizeObserver {
+ observe = vi.fn();
+ unobserve = vi.fn();
+ disconnect = vi.fn();
+}
+
+beforeEach(() => {
+ vi.stubGlobal("ResizeObserver", StubResizeObserver);
+ transcription.status = "idle";
+ transcription.request.mockClear();
+ const document = createEmptyDocument({ projectId: "p", title: "t" });
+ useProjectStore.setState({
+ projectId: "p",
+ document: {
+ ...document,
+ assets: [assetSchema.parse({ id: "asset-1", label: "take", originalPath: "/rec/take.mp4" })],
+ },
+ });
+});
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+ useProjectStore.setState({ document: null });
+});
+
+async function openDetail() {
+ render(
+ <TooltipProvider>
+ <MediaStage onAddToTimeline={vi.fn(async () => undefined)} />
+ </TooltipProvider>,
+ );
+ fireEvent.click(await screen.findByRole("button", { name: /take/ }));
+ return screen.findByRole("button", { name: "mediaStage.regenerate" });
+}
+
+describe("MediaStage Regenerate button", () => {
+ it("asks for a new transcription, and says what it redoes in its tooltip", async () => {
+ const regenerate = await openDetail();
+ expect(regenerate).not.toHaveAttribute("title");
+ act(() => regenerate.focus());
+ expect((await screen.findByRole("tooltip")).textContent).toBe("mediaStage.regenerateTip");
+ fireEvent.click(regenerate);
+ expect(transcription.request).toHaveBeenCalledWith("asset-1", "auto");
+ });
+
+ it("stays focusable and keeps its tooltip while a transcription runs, and fires nothing", async () => {
+ transcription.status = "running";
+ const regenerate = await openDetail();
+
+ // Greyed and announced as disabled, but not natively disabled.
+ expect(regenerate).toHaveAttribute("aria-disabled", "true");
+ expect(regenerate).not.toBeDisabled();
+ expect(regenerate).toHaveStyle({ opacity: "0.6", cursor: "not-allowed" });
+ expect(regenerate.querySelector("svg")).toHaveClass("animate-spin");
+
+ act(() => regenerate.focus());
+ expect(regenerate).toHaveFocus();
+ expect((await screen.findByRole("tooltip")).textContent).toBe("mediaStage.regenerateTip");
+
+ fireEvent.click(regenerate);
+ expect(transcription.request).not.toHaveBeenCalled();
+ });
+});
diff --git a/src/components/ai-edition/v4/MediaStage.tsx b/src/components/ai-edition/v4/MediaStage.tsx
index 60057bdd9..bb30e2115 100644
--- a/src/components/ai-edition/v4/MediaStage.tsx
+++ b/src/components/ai-edition/v4/MediaStage.tsx
@@ -426,8 +426,14 @@ export function MediaStage({
<button
type="button"
aria-label={t("mediaStage.regenerate")}
- disabled={selectedBusy}
- onClick={() => void requestTranscription(selected.id, lang)}
+ // `aria-disabled`, not `disabled`: a natively disabled button cannot take focus or
+ // open its tooltip. It does nothing while a transcription runs.
+ aria-disabled={selectedBusy || undefined}
+ onClick={
+ selectedBusy
+ ? undefined
+ : () => void requestTranscription(selected.id, lang)
+ }
style={{
width: 36,
height: 36,
diff --git a/src/components/ai-edition/v4/RecStage.test.tsx b/src/components/ai-edition/v4/RecStage.test.tsx
index ed10b92e1..b79308df3 100644
--- a/src/components/ai-edition/v4/RecStage.test.tsx
+++ b/src/components/ai-edition/v4/RecStage.test.tsx
@@ -607,6 +607,26 @@ describe("RecStage names and tooltips", () => {
expect(await tooltipOn(pill("rec.editableCursor"))).toBe("rec.editableCursorTip");
});
+ // To the left a tooltip sits on the label the user is reading, and below the last row it covers
+ // Start recording: it opens above the pill.
+ it("opens the row tooltips above their pill, never over the row's own label", async () => {
+ stubRecordingPrefs({ cursorCaptureMode: "editable-overlay" });
+ // Windows offers the desktop icons row too, so all three tooltips can be checked.
+ Object.assign(window.electronAPI as object, { getPlatform: () => "win32" });
+ renderRecStage();
+ await screen.findByText("rec.hideDesktopIcons");
+ for (const row of ["rec.systemAudio", "rec.editableCursor", "rec.hideDesktopIcons"]) {
+ const control = pill(row);
+ act(() => control.focus());
+ await screen.findByRole("tooltip");
+ expect(
+ document.querySelector('[data-slot="tooltip-content"]')?.getAttribute("data-side"),
+ ).toBe("top");
+ act(() => control.blur());
+ await waitFor(() => expect(screen.queryByRole("tooltip")).toBeNull());
+ }
+ });
+
// Decided: the rest are labelled and say what they do, so a tooltip would repeat the label.
it("gives the microphone, camera and auto-zoom pills no tooltip", async () => {
await renderReady();
diff --git a/src/components/ai-edition/v4/RecStage.tsx b/src/components/ai-edition/v4/RecStage.tsx
index 754f5738b..658ed6b4d 100644
--- a/src/components/ai-edition/v4/RecStage.tsx
+++ b/src/components/ai-edition/v4/RecStage.tsx
@@ -357,8 +357,10 @@ export function RecStage({
{t("rec.systemAudio")}
</div>
{/* "System audio" is jargon for what the computer plays: the one row whose label
- alone does not say what it records. */}
- <Tooltip content={t("rec.systemAudioTip")} side="left">
+ alone does not say what it records. The row tooltips open above their pill: to
+ the left they would sit on the label being read, and below the last row they
+ would cover Start recording. */}
+ <Tooltip content={t("rec.systemAudioTip")} side="top">
<button
type="button"
className={`${styles.recToggleBtn}${prefs.systemAudioEnabled ? ` ${styles.on}` : ""}`}
@@ -485,7 +487,7 @@ export function RecStage({
<MousePointer2 size={15} />
{t("rec.editableCursor")}
</div>
- <Tooltip content={t("rec.editableCursorTip")} side="left">
+ <Tooltip content={t("rec.editableCursorTip")} side="top">
<button
type="button"
className={`${styles.recToggleBtn}${editableCursor ? ` ${styles.on}` : ""}`}
@@ -530,7 +532,7 @@ export function RecStage({
<LayoutGrid size={15} />
{t("rec.hideDesktopIcons")}
</div>
- <Tooltip content={desktopIconsHint} side="left">
+ <Tooltip content={desktopIconsHint} side="top">
<button
type="button"
className={`${styles.recToggleBtn}${prefs.hideDesktopIcons ? ` ${styles.on}` : ""}`}
diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsx
index ecdd3a888..d10d30d15 100644
--- a/src/components/ai-edition/v4/V4Timeline.tsx
+++ b/src/components/ai-edition/v4/V4Timeline.tsx
@@ -1828,7 +1828,12 @@ export function V4Timeline({
type="button"
className={styles.tlToolBtn}
aria-label={t("toolbar.autoEnhance")}
- disabled={autoBusy}
+ // `aria-disabled`, not `disabled`, so the tooltip still opens while a pass runs; the
+ // click must not open the menu meanwhile (Radix skips a prevented click).
+ aria-disabled={autoBusy || undefined}
+ onClick={(e) => {
+ if (autoBusy) e.preventDefault();
+ }}
>
{autoBusy ? (
<Loader2 className="animate-spin" size={16} />