Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Visible focus, fewer tab stops, dead tokens removed

Bitti1a98c2763917
diff --git a/src/components/ProjectCard.tsx b/src/components/ProjectCard.tsx
index d839ba3..1effcea 100644
--- a/src/components/ProjectCard.tsx
+++ b/src/components/ProjectCard.tsx
@@ -49,10 +49,10 @@ export function ProjectCard({ project, index, onOpen }: ProjectCardProps) {
};
}, [menuOpen]);
+ // The card itself is not a tab stop: the art button below already opens the
+ // project from the keyboard, so a focusable card only added a duplicate stop.
return (
- <article className="project-card" tabIndex={0} onDoubleClick={() => onOpen(project)} onKeyDown={(event) => {
- if (event.key === "Enter" && event.currentTarget === event.target) onOpen(project);
- }}>
+ <article className="project-card" onDoubleClick={() => onOpen(project)}>
<button className="project-card__art-button" onClick={() => onOpen(project)} aria-label={`Open ${config.name}`}>
<div className={`project-card__art project-card__art--${artwork[index % artwork.length]}`} style={style}>
<span className="project-card__format"><Ratio size={13} /> {config.settings.aspectRatio}</span>
@@ -77,7 +77,7 @@ export function ProjectCard({ project, index, onOpen }: ProjectCardProps) {
</div>
)}
</div>
- <p className="project-card__path" title={project.folderPath}><Folder size={13} /> {project.folderPath}</p>
+ <p className="project-card__path" title={project.folderPath}><Folder size={13} /><span>{project.folderPath}</span></p>
<div className="project-card__meta">
<span><Clock3 size={14} /> Edited {relativeDate(config.updatedAt)}</span>
<span>{durationLabel(config.brief.targetDurationSeconds)}</span>
diff --git a/src/components/PromptComposer.tsx b/src/components/PromptComposer.tsx
index 4281d24..329ddac 100644
--- a/src/components/PromptComposer.tsx
+++ b/src/components/PromptComposer.tsx
@@ -1,5 +1,5 @@
import { ChevronDown, Clapperboard, Clock3, ImagePlus, Monitor, Sparkles, WandSparkles, X } from "lucide-react";
-import { useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { chooseInitialReferenceImages, isTauri } from "../lib/persistence";
import type { AspectRatio, CreateProjectInput, Resolution } from "../lib/project";
import { projectNameFromPrompt } from "../lib/project";
@@ -50,9 +50,20 @@ export function PromptComposer({ busy, onCreate }: PromptComposerProps) {
const [duration, setDuration] = useState(60);
const [referenceImages, setReferenceImages] = useState<NonNullable<CreateProjectInput["referenceImages"]>>([]);
const [referenceError, setReferenceError] = useState<string | null>(null);
+ const promptInput = useRef<HTMLTextAreaElement>(null);
const referencesAvailable = isTauri();
+ /* The description box is the first thing you use, so start in it — saving a
+ click on the headline flow. Runs once, and only while focus is still on the
+ document body, so it never yanks focus off a field the user already picked
+ (Ctrl+K search included). */
+ useEffect(() => {
+ const active = document.activeElement;
+ if (active && active !== document.body) return;
+ promptInput.current?.focus({ preventScroll: true });
+ }, []);
+
const addReferenceImages = async () => {
setReferenceError(null);
try {
@@ -88,6 +99,7 @@ export function PromptComposer({ busy, onCreate }: PromptComposerProps) {
<div className="composer__input-row">
<PolStudioLogo compact decorative className="composer__brand-mark" />
<textarea
+ ref={promptInput}
value={prompt}
onChange={(event) => setPrompt(event.target.value)}
onKeyDown={(event) => {
diff --git a/src/styles/base.css b/src/styles/base.css
index b27a95b..b3122d7 100644
--- a/src/styles/base.css
+++ b/src/styles/base.css
@@ -97,7 +97,7 @@ select:focus-visible,
summary:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
- outline: 2px solid var(--accent-bright);
+ outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: 2px;
}
diff --git a/src/styles/controls.css b/src/styles/controls.css
index b5cd133..984407a 100644
--- a/src/styles/controls.css
+++ b/src/styles/controls.css
@@ -123,8 +123,13 @@
border-radius: var(--radius-md);
}
+/* The bordered wrapper IS the control, so it carries the focus ring — Ctrl+K
+ has to land somewhere obvious. The input's own ring is suppressed just below
+ so the two never stack. */
.search-field:focus-within {
border-color: rgba(92, 127, 236, 0.6);
+ outline: var(--focus-ring-width) solid var(--focus-ring-color);
+ outline-offset: 2px;
}
.search-field input {
@@ -133,7 +138,7 @@
height: 100%;
background: none;
border: 0;
- outline: none;
+ outline: none; /* .search-field:focus-within draws it */
color: var(--text-secondary);
font-size: var(--text-sm);
}
diff --git a/src/styles/library.css b/src/styles/library.css
index 0b2d301..4d05bc1 100644
--- a/src/styles/library.css
+++ b/src/styles/library.css
@@ -132,6 +132,15 @@
0 12px 30px rgba(0, 0, 0, 0.25);
}
+/* The textarea fills the box, so a ring on it alone would float inside the
+ padding. Put the app's ring on the wrapper instead. Scoped with :has() so
+ the buttons and <summary> inside the composer — which draw their own rings —
+ never get a second one around the whole box. */
+.composer:has(textarea:focus-visible) {
+ outline: var(--focus-ring-width) solid var(--focus-ring-color);
+ outline-offset: 2px;
+}
+
/* The description box is the hero: give it room to think in. */
.composer__input-row {
display: flex;
@@ -150,7 +159,7 @@
min-height: calc(var(--space-9) + var(--space-5));
resize: none;
border: 0;
- outline: 0;
+ outline: 0; /* .composer:has(…) draws the ring */
color: var(--text-primary);
background: transparent;
font-size: var(--text-md);
@@ -240,7 +249,7 @@
/* base.css gives focus rings to buttons/fields; <summary> is not in that list. */
.composer__options > summary:focus-visible {
- outline: 2px solid var(--accent-bright);
+ outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: -2px;
}
@@ -309,7 +318,6 @@
padding: 0 var(--space-3);
border: 1px solid var(--line-strong);
border-radius: var(--radius-sm);
- outline: 0;
color: var(--text-primary);
background: var(--panel-2);
font-size: var(--text-sm);
@@ -502,11 +510,10 @@
}
.project-card:hover,
-.project-card:focus {
+.project-card:focus-within {
transform: translateY(-2px);
border-color: rgba(117, 137, 198, 0.28);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.28);
- outline: none;
}
.project-card__art-button {
@@ -514,9 +521,17 @@
width: 100%;
padding: 0;
border: 0;
+ border-radius: var(--radius-lg);
background: none;
}
+/* The card clips its children, so the default outset ring on this button would
+ be cut off on three sides. Draw the same ring just inside the artwork. */
+.project-card__art-button:focus-visible {
+ outline: var(--focus-ring-width) solid var(--focus-ring-color);
+ outline-offset: -4px;
+}
+
.project-card__art {
position: relative;
overflow: hidden;
@@ -684,6 +699,7 @@
}
.project-card__body {
+ min-width: 0; /* lets the title/path ellipsize in list layout */
padding: var(--space-4);
}
@@ -743,13 +759,11 @@
}
.project-card__path {
+ min-width: 0;
margin: var(--space-1) 0 var(--space-3);
display: flex;
align-items: center;
gap: var(--space-1);
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
color: var(--text-faint);
font: var(--weight-regular) var(--text-2xs) / var(--leading-snug) var(--font-mono);
}
@@ -758,6 +772,15 @@
flex: 0 0 auto;
}
+/* text-overflow does nothing on the flex container itself, so the path has to
+ truncate on its own flex item — same pattern as the card title above. */
+.project-card__path span {
+ min-width: 0;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
.project-card__meta {
border-top: 1px solid var(--line);
padding-top: var(--space-3);
diff --git a/src/styles/tokens.css b/src/styles/tokens.css
index 28f35ef..3c2cf9d 100644
--- a/src/styles/tokens.css
+++ b/src/styles/tokens.css
@@ -116,12 +116,11 @@
--shadow: 0 22px 65px rgba(0, 0, 0, 0.34);
--shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.28);
- /* --- Legacy aliases ------------------------------------------------------
- Kept so in-flight work that still references the old names keeps working.
- Do not use these in new rules. */
- --muted: var(--text-muted);
- --soft: var(--text-secondary);
- --blue: var(--accent);
- --blue-bright: var(--accent-bright);
- --blue-dark: var(--accent-dark);
+ /* --- Focus --------------------------------------------------------------
+ One ring for the whole app. base.css applies it to focusable elements;
+ composite controls (search field, composer) apply it to the wrapper that
+ reads as the control, and suppress the inner element's own ring so the
+ two never stack. */
+ --focus-ring-width: 2px;
+ --focus-ring-color: var(--accent-bright);
}