fix(view): stage navigation highlights the active stage

The highlight is the 'current' class, but the stage switch only changed
aria-current, so ① stayed highlighted while ③ was shown. The switch now moves
the class with aria-current.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
ypshimandClaude Haiku 5.5 committed 2026-10-22 12:04:44 +09:00
1 parent 5cc166c2e1
commit 64d415f891
1 file changed
+7 -3
+7 -3
View File
@@ -675,9 +675,13 @@ function setStage(stage: 'shape' | 'plan' | 'rebar'): void {
$<HTMLElement>('view-shape').hidden = stage !== 'shape';
$<HTMLElement>('view-plan').hidden = stage !== 'plan';
$<HTMLElement>('view-rebar').hidden = stage !== 'rebar';
$<HTMLButtonElement>('nav-shape').setAttribute('aria-current', String(stage === 'shape'));
$<HTMLButtonElement>('nav-plan').setAttribute('aria-current', String(stage === 'plan'));
$<HTMLButtonElement>('nav-rebar').setAttribute('aria-current', String(stage === 'rebar'));
// The highlight is the 'current' class (style.css); aria-current is set alongside it for assistive tech.
const nav: [string, 'shape' | 'plan' | 'rebar'][] = [['nav-shape', 'shape'], ['nav-plan', 'plan'], ['nav-rebar', 'rebar']];
for (const [id, key] of nav) {
const btn = $<HTMLButtonElement>(id);
btn.classList.toggle('current', stage === key);
btn.setAttribute('aria-current', String(stage === key));
}
renderAll();
}