From 64d415f891f5ebede03d175ceb830ae4e0122483 Mon Sep 17 00:00:00 2001 From: ypshim Date: Thu, 22 Oct 2026 12:04:44 +0900 Subject: [PATCH] fix(view): stage navigation highlights the active stage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/main.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index 235060f..0bf803b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -675,9 +675,13 @@ function setStage(stage: 'shape' | 'plan' | 'rebar'): void { $('view-shape').hidden = stage !== 'shape'; $('view-plan').hidden = stage !== 'plan'; $('view-rebar').hidden = stage !== 'rebar'; - $('nav-shape').setAttribute('aria-current', String(stage === 'shape')); - $('nav-plan').setAttribute('aria-current', String(stage === 'plan')); - $('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 = $(id); + btn.classList.toggle('current', stage === key); + btn.setAttribute('aria-current', String(stage === key)); + } renderAll(); }