Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Polish settings fields and sub-page title focus

Bitti5729757e05fb
diff --git a/src/components/AdditionalSafetensorsEditor.tsx b/src/components/AdditionalSafetensorsEditor.tsx
index 4a10bb6..1d58bba 100644
--- a/src/components/AdditionalSafetensorsEditor.tsx
+++ b/src/components/AdditionalSafetensorsEditor.tsx
@@ -18,11 +18,11 @@ export function AdditionalSafetensorsEditor({ value, disabled, animate, onChange
control={<button type="button" className="icon-button" disabled={disabled} aria-label={`Remove additional safetensor ${index + 1}`} data-tooltip="Remove"
onClick={() => onChange(value.filter((entry) => entry.id !== file.id))}><Trash2 size={16} /></button>}>
<SettingsRow header="Name">
- <input className="settings-field" aria-label={`Additional safetensor ${index + 1} name`} value={file.name} disabled={disabled}
+ <input className="text-field settings-field" aria-label={`Additional safetensor ${index + 1} name`} value={file.name} disabled={disabled}
onChange={(event) => update(file.id, { name: event.target.value })} />
</SettingsRow>
<SettingsRow header="Download URL">
- <input className="settings-field" aria-label={`Additional safetensor ${index + 1} URL`} defaultValue={file.url} disabled={disabled} spellCheck={false} onBlur={(event) => {
+ <input className="text-field settings-field" aria-label={`Additional safetensor ${index + 1} URL`} defaultValue={file.url} disabled={disabled} spellCheck={false} onBlur={(event) => {
const next = event.target.value.trim();
if (!isDownloadUrl(next)) { setError("Enter an HTTP or HTTPS download URL."); return; }
setError(null);
@@ -37,7 +37,7 @@ export function AdditionalSafetensorsEditor({ value, disabled, animate, onChange
</SettingsRow>}
</SettingsExpander>)}
<SettingsCard icon={<Plus size={20} />} header="Add a file" description="Downloads with this generator into your weights folder">
- <input className="settings-field" aria-label="Add additional safetensor URL" value={url} disabled={disabled} placeholder="https://…" spellCheck={false}
+ <input className="text-field settings-field" aria-label="Add additional safetensor URL" value={url} disabled={disabled} placeholder="https://…" spellCheck={false}
onChange={(event) => setUrl(event.target.value)} />
<button type="button" className="secondary-button" disabled={disabled || !isDownloadUrl(url) || value.some((file) => file.url === url.trim())} onClick={() => {
onChange([...value, { id: crypto.randomUUID(), name: url.trim().split("/").pop()?.split("?")[0] || "Additional safetensor", url: url.trim(),
diff --git a/src/components/LoraSettings.tsx b/src/components/LoraSettings.tsx
index 6dd5ea1..a817f4e 100644
--- a/src/components/LoraSettings.tsx
+++ b/src/components/LoraSettings.tsx
@@ -95,12 +95,12 @@ export function LoraEditor({ loraId, onDone }: { loraId: string; onDone: () => v
primaryText={saving ? "Preparing LoRA…" : existing ? "Save" : "Add"} onPrimary={() => void save()} primaryDisabled={saving || Boolean(download?.active) || invalid}
closeText="Cancel" onClose={onDone} defaultButton="primary" disableEscape={saving}>
<fieldset className="lora-manual" disabled={saving}>
- <label>Name<input aria-label="LoRA name" value={name} onChange={(event) => setName(event.target.value)} /></label>
- <label>Local file<span className="lora-manual__path"><input aria-label="LoRA path" value={path} spellCheck={false} onChange={(event) => setPath(event.target.value)} placeholder="Absolute path to a .safetensors file" />
+ <label>Name<input className="text-field" aria-label="LoRA name" value={name} onChange={(event) => setName(event.target.value)} /></label>
+ <label>Local file<span className="lora-manual__path"><input className="text-field" aria-label="LoRA path" value={path} spellCheck={false} onChange={(event) => setPath(event.target.value)} placeholder="Absolute path to a .safetensors file" />
<button className="secondary-button" type="button" disabled={!isTauri()} onClick={() => void browse()}>Browse…</button></span></label>
<Checkbox aria-label="Override step count" checked={override} onChange={setOverride} label="Override step count"
description="The highest override among active LoRAs replaces the scene's step count." />
- {override && <label>Step count<input aria-label="LoRA step override" type="number" min={2} max={MAX_GENERATION_STEPS} step={1} value={steps} onChange={(event) => setSteps(event.target.value)} /></label>}
+ {override && <label>Step count<input className="text-field" aria-label="LoRA step override" type="number" min={2} max={MAX_GENERATION_STEPS} step={1} value={steps} onChange={(event) => setSteps(event.target.value)} /></label>}
<Checkbox aria-label="Download missing timestep grid" checked={allowDownload} onChange={setAllowDownload} label="Download missing timestep grid"
description="New files are prepared in place before use, which may embed a timestep grid." />
{error && <InfoBar severity="error" message={error} />}
@@ -126,7 +126,7 @@ export function TemplateLorasEditor({ value, onChange }: { value: TemplateLora[]
const name = lora?.name ?? "Missing LoRA";
return <SettingsCard key={entry.loraId} className="template-lora" icon={<Layers size={20} />} header={`${index + 1}. ${name}`}
description={!lora?.path ? (lora?.url ? "Download required" : "File unavailable") : undefined}>
- <label className="template-lora__strength">Strength<input className="settings-field settings-field--number" type="number" step="0.1" aria-label={`${name} strength`} value={entry.strength}
+ <label className="template-lora__strength">Strength<input className="text-field settings-field settings-field--number" type="number" step="0.1" aria-label={`${name} strength`} value={entry.strength}
onChange={(event) => { const strength = Number(event.target.value); if (event.target.value && Number.isFinite(strength)) update(index, { strength }); }} /></label>
<button className="icon-button" type="button" aria-label={`Move ${name} up`} data-tooltip="Move up" disabled={index === 0} onClick={() => move(index, -1)}><ArrowUp size={16} /></button>
<button className="icon-button" type="button" aria-label={`Move ${name} down`} data-tooltip="Move down" disabled={index === value.length - 1} onClick={() => move(index, 1)}><ArrowDown size={16} /></button>
diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsx
index 7aaebf2..1c868a4 100644
--- a/src/components/SettingsView.tsx
+++ b/src/components/SettingsView.tsx
@@ -229,7 +229,7 @@ function DiagnosticsSetting({ desktop, status, onBackendChange }: { desktop: boo
}
};
- return <SettingsGroup heading="Diagnostics">
+ return <SettingsGroup>
<SettingsCard icon={<Cpu size={20} />} header="GPU backend">
<ComboBox aria-label="GPU backend" value={cudaAvailable ? backend : "vulkan"} disabled={!desktop || !cudaAvailable} onChange={(value) => {
const next = value as InferenceBackend;
@@ -466,7 +466,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
const description = editing
? <input
id={`engine-${field.id}`}
- className="settings-path__input"
+ className="text-field settings-path__input"
aria-label={field.label}
value={value}
spellCheck={false}
@@ -519,14 +519,14 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
<SettingsGroup heading="General">
<SettingsCard icon={<SquarePen size={20} />} header="Name">
- <input ref={nameField} className="settings-field" aria-label="Generator name" value={selectedTemplate.name} onChange={(event) => updateTemplate({ name: event.target.value })} onBlur={() => { if (!selectedTemplate.name.trim()) updateTemplate({ name: "Untitled generator" }); }} />
+ <input ref={nameField} className="text-field settings-field" aria-label="Generator name" value={selectedTemplate.name} onChange={(event) => updateTemplate({ name: event.target.value })} onBlur={() => { if (!selectedTemplate.name.trim()) updateTemplate({ name: "Untitled generator" }); }} />
</SettingsCard>
<SettingsCard icon={<Video size={20} />} header="Mode">
<ComboBox aria-label="Generator mode" value={selectedTemplate.mode ?? "prompt"} onChange={(value) => updateTemplate({ mode: value === "animate" ? "animate" : "prompt" })}
options={[{ value: "prompt", label: "Text prompt" }, { value: "animate", label: "Animate (reference video)" }]} />
</SettingsCard>
- <SettingsCard icon={<ListOrdered size={20} />} header="Default steps" description={`2 to ${MAX_GENERATION_STEPS}`}>
- <input className="settings-field settings-field--number" aria-label="Generator default steps" type="number" min={2} max={MAX_GENERATION_STEPS} step={1} value={selectedTemplate.defaultSteps} onChange={(event) => {
+ <SettingsCard icon={<ListOrdered size={20} />} header="Default steps">
+ <input className="text-field settings-field settings-field--number" aria-label="Generator default steps" type="number" min={2} max={MAX_GENERATION_STEPS} step={1} value={selectedTemplate.defaultSteps} onChange={(event) => {
const value = Number(event.target.value);
if (Number.isInteger(value) && value >= 2 && value <= MAX_GENERATION_STEPS) updateTemplate({ defaultSteps: value });
}} />
diff --git a/src/components/WeightSourcesEditor.tsx b/src/components/WeightSourcesEditor.tsx
index 236d946..2272ea1 100644
--- a/src/components/WeightSourcesEditor.tsx
+++ b/src/components/WeightSourcesEditor.tsx
@@ -13,18 +13,18 @@ export function WeightSourcesEditor({ label, sources, disabled, onChange }: {
description="Among matching GPUs, the highest minimum VRAM that fits is used">
<p className="settings-caption">GPU model matches part of the device name, such as “RTX 5090”. Leave it blank for any GPU.</p>
{sources.map((source, index) => <div className="weight-source" key={`${index}-${source.url}`}>
- <label>Download URL<input aria-label={`${label} variant ${index + 1} URL`} defaultValue={source.url} disabled={disabled} onBlur={(event) => {
+ <label>Download URL<input className="text-field" aria-label={`${label} variant ${index + 1} URL`} defaultValue={source.url} disabled={disabled} onBlur={(event) => {
const value = event.target.value.trim();
if (!isDownloadUrl(value)) { setError("Enter an HTTP or HTTPS download URL."); return; }
setError(null);
if (value !== source.url) update(index, { url: value, downloadedPath: undefined });
}} /></label>
- <label>GPU model<input aria-label={`${label} variant ${index + 1} GPU model`} defaultValue={source.gpuModel} placeholder="Any GPU" disabled={disabled} onBlur={(event) => update(index, { gpuModel: event.target.value })} /></label>
- <label>Minimum VRAM (GB)<input aria-label={`${label} variant ${index + 1} minimum VRAM`} type="number" min={0} step={1} value={source.minVramGb} disabled={disabled} onChange={(event) => update(index, { minVramGb: Math.max(0, Number(event.target.value) || 0) })} /></label>
+ <label>GPU model<input className="text-field" aria-label={`${label} variant ${index + 1} GPU model`} defaultValue={source.gpuModel} placeholder="Any GPU" disabled={disabled} onBlur={(event) => update(index, { gpuModel: event.target.value })} /></label>
+ <label>Minimum VRAM (GB)<input className="text-field" aria-label={`${label} variant ${index + 1} minimum VRAM`} type="number" min={0} step={1} value={source.minVramGb} disabled={disabled} onChange={(event) => update(index, { minVramGb: Math.max(0, Number(event.target.value) || 0) })} /></label>
<button type="button" className="icon-button" disabled={disabled} onClick={() => onChange(sources.filter((_, i) => i !== index))} aria-label={`Remove ${label} variant ${index + 1}`} data-tooltip="Remove variant"><Trash2 size={16} /></button>
</div>)}
<div className="weight-source-add">
- <input aria-label={`Add ${label} download URL`} value={url} disabled={disabled} placeholder="https://…" onChange={(event) => setUrl(event.target.value)} />
+ <input className="text-field" aria-label={`Add ${label} download URL`} value={url} disabled={disabled} placeholder="https://…" onChange={(event) => setUrl(event.target.value)} />
<button type="button" className="secondary-button" disabled={disabled || !isDownloadUrl(url) || sources.some((source) => source.url === url.trim())} onClick={() => {
onChange([...sources, { url: url.trim(), gpuModel: "", minVramGb: 0 }]); setUrl("");
}}><Plus size={16} /> Add URL</button>
diff --git a/src/styles/settings.css b/src/styles/settings.css
index 678af8d..bbe6545 100644
--- a/src/styles/settings.css
+++ b/src/styles/settings.css
@@ -86,6 +86,15 @@
padding: var(--space-3) 0 var(--space-4);
}
+/* The sub-page title takes focus so a screen reader announces the page; it
+ is not a control, so it never shows a focus visual. */
+.settings-page__title:focus,
+.settings-breadcrumb h1:focus,
+.settings-breadcrumb h1:focus-visible {
+ outline: none;
+ box-shadow: none;
+}
+
.settings-breadcrumb h1 {
min-width: 0;
overflow: hidden;