The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Shorts Studio, Mixed Media: arrow keys move between the page tabs
Claudeccf2d6e7e217
diff --git a/src/components/mixed-media/mixed-studio.tsx b/src/components/mixed-media/mixed-studio.tsxindex 6efb48a8..ddc7527d 100644--- a/src/components/mixed-media/mixed-studio.tsx+++ b/src/components/mixed-media/mixed-studio.tsx@@ -9,7 +9,7 @@ import { EngineSwitch } from "@/components/studio/engine-switch";import { MediaThumb } from "@/components/studio/result-media";import { VideoTrimmer, type VideoTrimmerHandle } from "@/components/studio/video-trimmer";import { LookCard } from "@/components/shorts/preset-card";-import { ClipBar, ClipDrop, costText, Field, Segmented } from "@/components/shorts/ui";+import { ClipBar, ClipDrop, costText, Field, Segmented, tabKeys } from "@/components/shorts/ui";import { clipDuration, useSourceClip } from "@/components/shorts/use-source-clip";import { uploadFile, useEngine } from "@/lib/api";import {@@ -69,13 +69,14 @@ export function MixedStudio({ models }: { models: Record<Engine, RestyleModelInf<header className="sticky top-0 z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6"><SidebarTrigger className="md:hidden" /><h1 className="sr-only font-heading text-[22px] leading-none sm:not-sr-only sm:truncate">Mixed Media</h1>- <div role="tablist" aria-label="Mixed Media" className="fade-x scrollbar-none flex h-8 min-w-0 items-center overflow-x-auto rounded-full bg-muted p-0.5 sm:ml-4">+ <div role="tablist" aria-label="Mixed Media" onKeyDown={tabKeys} className="fade-x scrollbar-none flex h-8 min-w-0 items-center overflow-x-auto rounded-full bg-muted p-0.5 sm:ml-4">{TABS.map((t) => (<buttonkey={t.id}role="tab"type="button"aria-selected={tab === t.id}+ tabIndex={tab === t.id ? 0 : -1}onClick={() => pick(t.id)}className={cn("h-7 shrink-0 rounded-full px-3 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground", tab === t.id && "bg-background text-foreground shadow-soft")}>diff --git a/src/components/shorts/shorts-studio.tsx b/src/components/shorts/shorts-studio.tsxindex 4b2d20cb..a6dcdcd6 100644--- a/src/components/shorts/shorts-studio.tsx+++ b/src/components/shorts/shorts-studio.tsx@@ -28,7 +28,7 @@ import { CustomPresetDialog } from "./custom-preset-dialog";import { useShortsActions, useShortsEstimate, useShortsPresets, type ShortsBody } from "./hooks";import { CreateCard, CustomCard, LookCard } from "./preset-card";import { ShortsHistory } from "./history";-import { ClipBar, ClipDrop, costText, Field, Segmented, Steps } from "./ui";+import { ClipBar, ClipDrop, costText, Field, Segmented, Steps, tabKeys } from "./ui";import { clipDuration, useSourceClip } from "./use-source-clip";export type ModelChoice = RestyleModelInfo;@@ -72,13 +72,14 @@ export function ShortsStudio({ models }: { models: Record<Engine, ModelChoice[]><header className="sticky top-0 z-20 flex h-14 items-center gap-2 bg-background/85 px-3 backdrop-blur sm:px-6"><SidebarTrigger className="md:hidden" /><h1 className="truncate font-heading text-[22px] leading-none">Shorts Studio</h1>- <div role="tablist" aria-label="Shorts Studio" className="ml-2 flex h-8 items-center rounded-full bg-muted p-0.5 sm:ml-4">+ <div role="tablist" aria-label="Shorts Studio" onKeyDown={tabKeys} className="ml-2 flex h-8 items-center rounded-full bg-muted p-0.5 sm:ml-4">{(["presets", "history"] as const).map((t) => (<buttonkey={t}role="tab"type="button"aria-selected={tab === t}+ tabIndex={tab === t ? 0 : -1}onClick={() => pickTab(t)}className={cn("h-7 rounded-full px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground", tab === t && "bg-background text-foreground shadow-soft")}>diff --git a/src/components/shorts/ui.tsx b/src/components/shorts/ui.tsxindex 270cd0d7..d15d102d 100644--- a/src/components/shorts/ui.tsx+++ b/src/components/shorts/ui.tsx@@ -48,6 +48,19 @@ export function Segmented<T extends string | number>({);}+/** Tabs pattern for a role="tablist": arrows (and Home / End) move to the next tab and open it; only the open tab is a Tab stop. */+export function tabKeys(e: React.KeyboardEvent<HTMLElement>) {+ const step = ({ ArrowRight: 1, ArrowLeft: -1 } as Record<string, number>)[e.key];+ if (step === undefined && e.key !== "Home" && e.key !== "End") return;+ const tabs = [...e.currentTarget.querySelectorAll<HTMLElement>('[role="tab"]')];+ if (!tabs.length) return;+ e.preventDefault();+ const at = tabs.indexOf(document.activeElement as HTMLElement);+ const next = e.key === "Home" ? 0 : e.key === "End" ? tabs.length - 1 : (Math.max(at, 0) + step + tabs.length) % tabs.length;+ tabs[next].focus();+ tabs[next].click();+}+/** A labelled block in a setup panel. */export function Field({ label, htmlFor, hint, children }: { label: string; htmlFor?: string; hint?: React.ReactNode; children: React.ReactNode }) {return (