diff --git a/canvas/src/components/ThemeToggle.tsx b/canvas/src/components/ThemeToggle.tsx index 5c8cfaec..d10d07c5 100644 --- a/canvas/src/components/ThemeToggle.tsx +++ b/canvas/src/components/ThemeToggle.tsx @@ -62,11 +62,11 @@ export function ThemeToggle({ className = "" }: { className?: string }) { } setTheme(OPTIONS[next].value); // Move focus to the new button so arrow-key navigation is continuous. - // Use direct-child query to scope strictly to this radiogroup's buttons - // and avoid accidentally focusing unrelated [role=radio] elements + // Query is already scoped to radiogroup so no child-combinator needed; + // avoids accidentally focusing unrelated [role=radio] elements // elsewhere in the DOM (e.g. React Flow canvas nodes). const radiogroup = e.currentTarget.closest("[role=radiogroup]") as HTMLElement | null; - const btns = radiogroup?.querySelectorAll("> [role=radio]"); + const btns = radiogroup?.querySelectorAll("[role=radio]"); btns?.[next]?.focus(); }, []