Skip to content

Commit 65a155a

Browse files
committed
fix(export): name the GIF loop toggle for screen readers
The switch renders no text of its own, so aria-pressed announced a state without ever saying which setting it was. Reuse the shared Toggle, which already takes an ariaLabel for exactly this, instead of the hand-rolled button. Reported by CodeRabbit on #883.
1 parent 3a34628 commit 65a155a

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

‎src/components/ai-edition/ExportDialog.params.test.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ describe("ExportDialog format settings", () => {
171171
expect(social?.bitrate).toBe((web?.bitrate ?? 0) / 2);
172172
});
173173

174+
it("gives the GIF loop toggle an accessible name", () => {
175+
// The switch renders no text of its own; without a name a screen reader only
176+
// announces "pressed" and never says which setting it is.
177+
renderDialog();
178+
fireEvent.click(screen.getByRole("button", { name: "GIF" }));
179+
expect(screen.getByRole("button", { name: "Loop GIF" })).toHaveAttribute(
180+
"aria-pressed",
181+
"true",
182+
);
183+
});
184+
174185
it("a GIF is 15 fps and README-sized at the small preset", async () => {
175186
renderDialog();
176187
fireEvent.click(screen.getByRole("button", { name: "GIF" }));

‎src/components/ai-edition/ExportDialog.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import type { CompositorClipInput } from "@/native/contracts";
4444
import { buildSceneDescription, resolveVisibleClips } from "@/native/sceneDescription";
4545
import { ModalShell } from "./Modals";
4646
import styles from "./NewEditorShell.module.css";
47+
import { Toggle } from "./RightPanes";
4748

4849
type Phase = "idle" | "configuring" | "rendering" | "writing" | "done" | "error";
4950

@@ -669,12 +670,11 @@ export function ExportDialog({ open, onClose, document }: ExportDialogProps) {
669670
</div>
670671
<div className={styles.paneRow} style={{ margin: 0 }}>
671672
<span className={styles.label}>{t("exportDialog.loopGif")}</span>
672-
<button
673-
type="button"
674-
className={`${styles.toggle} ${gifLoop ? styles.isOn : ""}`}
675-
aria-pressed={gifLoop}
673+
<Toggle
674+
checked={gifLoop}
675+
ariaLabel={t("exportDialog.loopGif")}
676676
disabled={isBusy}
677-
onClick={() => setGifLoop((v) => !v)}
677+
onChange={setGifLoop}
678678
/>
679679
</div>
680680
<div

0 commit comments

Comments
 (0)