diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 2a4a5a2..16791aa 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -1,11 +1,12 @@ { "identifier": "default", - "description": "Default capabilities for YTDescGen. File access goes through the app's own name-only commands and native dialogs run from Rust, so the webview gets no dialog, fs or shell permissions.", + "description": "Default capabilities for YTDescGen. File access goes through the app's own name-only commands and native dialogs run from Rust, so the webview gets no dialog, fs or shell permissions. set-webview-zoom backs the Ctrl/Cmd +/- zoom polyfill Tauri injects on macOS and Linux (zoomHotkeysEnabled).", "windows": [ "main" ], "permissions": [ "core:default", + "core:webview:allow-set-webview-zoom", "opener:default" ] } diff --git a/src-tauri/gen/schemas/capabilities.json b/src-tauri/gen/schemas/capabilities.json index cba61e3..dad9ac8 100644 --- a/src-tauri/gen/schemas/capabilities.json +++ b/src-tauri/gen/schemas/capabilities.json @@ -1 +1 @@ -{"default":{"identifier":"default","description":"Default capabilities for YTDescGen. File access goes through the app's own name-only commands and native dialogs run from Rust, so the webview gets no dialog, fs or shell permissions.","local":true,"windows":["main"],"permissions":["core:default","opener:default"]}} \ No newline at end of file +{"default":{"identifier":"default","description":"Default capabilities for YTDescGen. File access goes through the app's own name-only commands and native dialogs run from Rust, so the webview gets no dialog, fs or shell permissions. set-webview-zoom backs the Ctrl/Cmd +/- zoom polyfill Tauri injects on macOS and Linux (zoomHotkeysEnabled).","local":true,"windows":["main"],"permissions":["core:default","core:webview:allow-set-webview-zoom","opener:default"]}} \ No newline at end of file diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 217de6b..12b7750 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -20,7 +20,8 @@ "resizable": true, "maximizable": true, "fullscreen": false, - "center": true + "center": true, + "zoomHotkeysEnabled": true } ], "security": { diff --git a/src/components/editor/EndingsEditor.tsx b/src/components/editor/EndingsEditor.tsx index f2f6e4c..259dc5d 100644 --- a/src/components/editor/EndingsEditor.tsx +++ b/src/components/editor/EndingsEditor.tsx @@ -265,6 +265,7 @@ export function EndingsEditor() { type="number" min={1} max={MAX_ENDINGS} + aria-label={t("editor.endings.rowNumberAria", { row: i + 1 })} value={entry.number?.toString() ?? ""} onChange={(e) => { const v = e.target.value.trim(); @@ -275,6 +276,7 @@ export function EndingsEditor() { updateEnding(i, { name: e.target.value })} /> @@ -322,8 +324,8 @@ export function EndingsEditor() { {t("editor.endings.videoLabel")} - From - To + {t("editor.endings.fromLabel")} + {t("editor.endings.toLabel")} @@ -335,6 +337,7 @@ export function EndingsEditor() { type="number" min={1} max={count} + aria-label={t("editor.endings.rangeFromAria", { video: i + 1 })} value={String(r.from)} onChange={(e) => updateRange(i, { from: Number(e.target.value) || 1 })} /> @@ -344,6 +347,7 @@ export function EndingsEditor() { type="number" min={1} max={count} + aria-label={t("editor.endings.rangeToAria", { video: i + 1 })} value={String(r.to)} onChange={(e) => updateRange(i, { to: Number(e.target.value) || 1 })} /> diff --git a/src/components/editor/GenreList.tsx b/src/components/editor/GenreList.tsx index 5dcdc4c..7da6b0a 100644 --- a/src/components/editor/GenreList.tsx +++ b/src/components/editor/GenreList.tsx @@ -39,7 +39,7 @@ export default function GenreList({ diff --git a/src/components/editor/GenreSelector.tsx b/src/components/editor/GenreSelector.tsx index be10cd4..162113c 100644 --- a/src/components/editor/GenreSelector.tsx +++ b/src/components/editor/GenreSelector.tsx @@ -77,14 +77,14 @@ export function GenreSelector() { {genres.map((id) => ( {labelOf(id)} diff --git a/src/components/editor/GpuList.tsx b/src/components/editor/GpuList.tsx index 7b566e4..a3f8bc1 100644 --- a/src/components/editor/GpuList.tsx +++ b/src/components/editor/GpuList.tsx @@ -55,7 +55,7 @@ export default function GpuList({ diff --git a/src/components/editor/LivePreview.tsx b/src/components/editor/LivePreview.tsx index e4e38e8..0c18346 100644 --- a/src/components/editor/LivePreview.tsx +++ b/src/components/editor/LivePreview.tsx @@ -33,6 +33,7 @@ export function LivePreview({ // Without a game name the engine still renders "— Gameplay No Commentary"; // show the prompt instead so nothing half-built can be copied. const hasGame = useEditorStore((s) => s.gameName.trim() !== ""); + const lang = useEditorStore((s) => s.language); const output = hasGame ? generated : EMPTY_GENERATOR_OUTPUT; const [tab, setTab] = useState("title"); @@ -73,7 +74,7 @@ export function LivePreview({ > {output.title ? ( -

+

{output.title}

) : ( @@ -82,7 +83,10 @@ export function LivePreview({
{output.description ? ( -
+            
               {output.description}
             
) : ( @@ -91,7 +95,7 @@ export function LivePreview({ {output.tags.length > 0 ? ( -
+
{output.tags.map((tag, i) => ( {customMode && ( store.set("vnBankName", e.target.value)} diff --git a/src/components/errors/OfflineBanner.tsx b/src/components/errors/OfflineBanner.tsx index e216772..cfc67d0 100644 --- a/src/components/errors/OfflineBanner.tsx +++ b/src/components/errors/OfflineBanner.tsx @@ -47,7 +47,7 @@ export function OfflineBanner() { type="button" onClick={() => setDismissed(true)} aria-label={t("common.dismiss")} - className="text-text-muted hover:bg-surface-2 hover:text-text-primary flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors" + className="text-text-muted hover:bg-surface-2 hover:text-text-primary flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors pointer-coarse:size-9" > - + {entry.title} @@ -75,7 +78,10 @@ export function HistoryCard({ entry }: { entry: HistoryEntry }) {
-
+          
             {entry.description}
           
diff --git a/src/components/layout/AppShell.tsx b/src/components/layout/AppShell.tsx index 4fe74dd..21c74bd 100644 --- a/src/components/layout/AppShell.tsx +++ b/src/components/layout/AppShell.tsx @@ -5,6 +5,7 @@ import { Header } from "./Header"; import { Sidebar, NavList, NavFooterLinks } from "./Sidebar"; import { MobileNav } from "./MobileNav"; import { ScrollToTopButton } from "./ScrollToTopButton"; +import { RouteAnnouncer } from "./RouteAnnouncer"; import { Drawer } from "@components/ui/Drawer"; import { useKeyboardShortcuts, type ShortcutHandlers } from "@hooks/use-keyboard-shortcuts"; import { useGlobalErrorHandler } from "@hooks/use-global-error-handler"; @@ -77,7 +78,7 @@ export function AppShell() { e.preventDefault(); mainRef.current?.focus(); }} - className="bg-accent text-accent-fg rounded-control sr-only z-[60] px-3 py-2 text-sm font-medium focus:not-sr-only focus:fixed focus:top-2 focus:left-2" + className="bg-accent-solid text-accent-fg rounded-control sr-only z-[60] px-3 py-2 text-sm font-medium focus:not-sr-only focus:fixed focus:top-2 focus:left-2" > {t("nav.skipToContent")} @@ -96,6 +97,7 @@ export function AppShell() { + setMoreOpen(true)} moreActive={moreOpen} /> diff --git a/src/components/layout/CommandPalette.tsx b/src/components/layout/CommandPalette.tsx index 0fa3875..be1574a 100644 --- a/src/components/layout/CommandPalette.tsx +++ b/src/components/layout/CommandPalette.tsx @@ -98,7 +98,7 @@ function PaletteBody({ Esc diff --git a/src/components/layout/RouteAnnouncer.tsx b/src/components/layout/RouteAnnouncer.tsx new file mode 100644 index 0000000..87bd1c0 --- /dev/null +++ b/src/components/layout/RouteAnnouncer.tsx @@ -0,0 +1,54 @@ +import { useEffect, useRef, useState } from "react"; +import { useLocation } from "react-router-dom"; +import { PAGE_TITLE_EVENT } from "@hooks/use-document-title"; + +/** A navigation whose page never names itself stops waiting after this long. */ +const PENDING_MS = 5000; + +/** + * Tells screen readers which page a navigation opened. A single-page app + * swaps the content without loading a page, so nothing is announced on its + * own. Focus stays where it was (on the link that was used), so keyboard users + * carry on from there. + * + * Every page names itself through useDocumentTitle, which fires + * PAGE_TITLE_EVENT — after the commit's effects, so a page rendered in the + * same commit as the path change is heard, and a lazy page is heard once its + * chunk arrives and it renders. A title change with no navigation behind it + * (switching the interface language) stays silent. + */ +export function RouteAnnouncer() { + const { pathname } = useLocation(); + const [message, setMessage] = useState(""); + const pending = useRef(false); + const lastPath = useRef(pathname); + + useEffect(() => { + const onTitle = (event: Event) => { + if (!pending.current || !(event instanceof CustomEvent)) return; + if (typeof event.detail !== "string") return; + pending.current = false; + setMessage(event.detail); + }; + window.addEventListener(PAGE_TITLE_EVENT, onTitle); + return () => window.removeEventListener(PAGE_TITLE_EVENT, onTitle); + }, []); + + useEffect(() => { + // The first page is announced by the browser's own page load (and + // Strict Mode's second run of this effect must not count as a visit). + if (pathname === lastPath.current) return; + lastPath.current = pathname; + pending.current = true; + const timer = window.setTimeout(() => { + pending.current = false; + }, PENDING_MS); + return () => window.clearTimeout(timer); + }, [pathname]); + + return ( +
+ {message} +
+ ); +} diff --git a/src/components/logs/LogEntry.tsx b/src/components/logs/LogEntry.tsx index 729e3b1..edb5faf 100644 --- a/src/components/logs/LogEntry.tsx +++ b/src/components/logs/LogEntry.tsx @@ -79,14 +79,14 @@ export function LogEntryCard({ entry }: { entry: LogEntryType }) { label={t("logs.copyEntry")} size="icon-sm" onClick={handleCopy} - className="size-7" + className="size-7 pointer-coarse:size-9" > deleteEntry(entry.id)} > diff --git a/src/components/output/OutputExtras.tsx b/src/components/output/OutputExtras.tsx index 3774bdb..04bf374 100644 --- a/src/components/output/OutputExtras.tsx +++ b/src/components/output/OutputExtras.tsx @@ -98,7 +98,7 @@ export function OutputExtras() { icon={MessageSquareText} actions={} > - {templateText} + {templateText} )} diff --git a/src/components/output/OutputField.tsx b/src/components/output/OutputField.tsx index 6e22664..1b3ec21 100644 --- a/src/components/output/OutputField.tsx +++ b/src/components/output/OutputField.tsx @@ -24,10 +24,22 @@ export function OutputField({ title, icon: Icon, actions, children }: OutputFiel ); } -/** Pre-formatted generated text, scrollable when long. */ -export function OutputText({ children, tall }: { children: ReactNode; tall?: boolean }) { +/** + * Pre-formatted generated text, scrollable when long. `lang` is the language + * the text was generated in, so a screen reader reads it with that voice. + */ +export function OutputText({ + children, + tall, + lang, +}: { + children: ReactNode; + tall?: boolean; + lang?: string; +}) { return (
 s.showCharCount);
   const compactTagDisplay = useSettingsStore((s) => s.compactTagDisplay);
+  const draftLanguage = useEditorStore((s) => s.language);
   const output = outputProp ?? defaultOutput;
+  // The cards' headings are interface text; only the generated text itself
+  // carries the output language.
+  const lang = langProp ?? draftLanguage;
 
   return (
     
@@ -48,7 +56,10 @@ export function OutputPreview({ } > -

+

{output.title || "…"}

@@ -71,7 +82,9 @@ export function OutputPreview({ } > - {output.description || "…"} + + {output.description || "…"} + {compactTagDisplay ? ( -

+

{output.tagString}

) : ( -
+
{output.tags.map((tag, i) => ( SEARCH_TITLE_CHARS; const descriptionCut = description.length > FOLD_DESCRIPTION_CHARS; @@ -51,18 +59,23 @@ export function YouTubePreview({ title, description, channelName, gameName }: Yo
-

+

{title || "…"}

{channel}

-

{description}

+

+ {description} +

{/* Watch page, above "…more" */}

- {fold || "…"} + {fold || "…"} {descriptionCut && ( {" "} diff --git a/src/components/ui/Banner.tsx b/src/components/ui/Banner.tsx index a1d4174..da5391a 100644 --- a/src/components/ui/Banner.tsx +++ b/src/components/ui/Banner.tsx @@ -58,7 +58,7 @@ export function Banner({ type="button" onClick={onDismiss} aria-label={dismissLabel} - className="-m-1 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md opacity-70 hover:opacity-100" + className="-m-1 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md opacity-70 hover:opacity-100 pointer-coarse:size-9" >

-

+

{lang.output.title}

-
+                      
                         {lang.output.description}
                       
{/* Batch showed a counter for the title only, so a row diff --git a/src/pages/OutputPage.tsx b/src/pages/OutputPage.tsx index ffd73bb..20660b3 100644 --- a/src/pages/OutputPage.tsx +++ b/src/pages/OutputPage.tsx @@ -244,6 +244,7 @@ export function OutputPage() { {multilangOutputs[lang] && ( @@ -258,6 +259,7 @@ export function OutputPage() { diff --git a/src/pages/PlaylistPage.tsx b/src/pages/PlaylistPage.tsx index f6bf3d9..92ceb61 100644 --- a/src/pages/PlaylistPage.tsx +++ b/src/pages/PlaylistPage.tsx @@ -80,11 +80,14 @@ function OutputBlock({ text, copyLabel, multiline, + lang, }: { label: string; text: string; copyLabel: string; multiline?: boolean; + /** Language the text was generated in. */ + lang: string; }) { return (
@@ -93,11 +96,16 @@ function OutputBlock({ {multiline ? ( -
+        
           {text || "…"}
         
) : ( -

{text || "…"}

+

+ {text || "…"} +

)}
); @@ -270,18 +278,21 @@ export function PlaylistPage() { label={t("output.title")} text={output.title} copyLabel={t("output.copyTitle")} + lang={language} />