refactor(settings): display mode should be a radio selector #
Area: Settings · Display · Mode · pages/settings.vue
Type: a11y / ui debt
Priority: p2
Summary #
The Display → Mode control (statistics / reduce) is currently a button group with aria-pressed. It should be a native radio group.
Current behavior #
pages/settings.vue:181-190:
<div class="data-row">
<span id="label-mode">{{ t('settings.mode') }}</span>
<div role="group" aria-labelledby="label-mode">
<button :aria-pressed="settings.mode==='statistics'" @click="updateSettings('mode','statistics')">…</button>
<button :aria-pressed="settings.mode==='reduce'" @click="updateSettings('mode','reduce')">…</button>
</div>
</div>
- Not keyboard-navigable via arrow keys, not a true radio semantic, screen readers announce as buttons not radios.
- Visual
→from.link-action::afterleaks into this control. t('settings.mode_description')is outside the group.
Expected behavior #
Replace with a native radio group:
<fieldset class="data-row">
<legend id="label-mode" class="data-row-label">{{ t('settings.mode') }}</legend>
<div class="flex gap-4">
<label class="flex items-center gap-2 text-xs">
<input type="radio" name="mode" value="statistics" :checked="settings.mode==='statistics'" @change="updateSettings('mode','statistics')">
{{ t('settings.statistics') }}
</label>
<label class="flex items-center gap-2 text-xs">
<input type="radio" name="mode" value="reduce" :checked="settings.mode==='reduce'" @change="updateSettings('mode','reduce')">
{{ t('settings.reduce') }}
</label>
</div>
</fieldset>
<p class="section-subtitle">{{ t('settings.mode_description') }}</p>
PATCH /api/v2/settings { mode }on change (existingupdateSettings('mode', …)).- Style radios to match marathon design: flattened
rounded-none,accent-primary,44pxhit area if needed — reusemarathon-components.cssor DaisyUIradiowithrounded-none. - Keyboard: arrow keys switch, Tab focuses group.
- Keep
dailyGoalconditional row (v-if="settings.mode==='reduce'") working.
Files to touch #
pages/settings.vue:181-192— mode block
Acceptance criteria #
How to test #
- Open Settings → Display → inspect Mode → should be radios.
- Toggle via click and via keyboard arrows → verify
dailyGoalrow appears/disappears forreduce. - Reload → selection persists.