Merge pull request 'fix(canvas): remove invalid CSS child-combinator from ThemeToggle querySelectorAll (closes #1008)' (#1012) from fix/1008-themetoggle-css-selector into staging
Some checks failed
Block internal-flavored paths / Block forbidden paths (push) Successful in 11s
Secret scan / Scan diff for credential-shaped strings (push) Successful in 19s
Harness Replays / detect-changes (push) Successful in 21s
Harness Replays / Harness Replays (push) Successful in 6s
CI / Detect changes (push) Successful in 32s
E2E API Smoke Test / detect-changes (push) Successful in 40s
Handlers Postgres Integration / detect-changes (push) Successful in 44s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 43s
CI / Platform (Go) (push) Successful in 5s
CI / Shellcheck (E2E scripts) (push) Successful in 5s
CI / Python Lint & Test (push) Successful in 6s
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 8s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 2m35s
Handlers Postgres Integration / Handlers Postgres Integration (push) Failing after 3m41s
CI / Canvas (Next.js) (push) Successful in 16m31s
CI / Canvas Deploy Reminder (push) Successful in 7s
CI / all-required (push) Failing after 12m3s

This commit is contained in:
devops-engineer 2026-05-14 13:53:04 +00:00
commit 4e8b40d1ea

View File

@ -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<HTMLButtonElement>("> [role=radio]");
const btns = radiogroup?.querySelectorAll<HTMLButtonElement>("[role=radio]");
btns?.[next]?.focus();
},
[]