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(); }