From 53664667d19b9ef96563589d67877547102b97b9 Mon Sep 17 00:00:00 2001 From: Christopher Rotnes Date: Sun, 3 May 2026 17:34:52 +0200 Subject: [PATCH] feat(a11y): add accessible labels and validation ARIA to form inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ExerciseRow: aria-label="Øvelsenavn" on exercise name input - ExerciseRow: aria-label, aria-invalid, aria-describedby on sets/reps inputs; off-screen error span announces "Ugyldig antall" to screen readers when invalid - MusclePicker: id on help text span + aria-describedby on picker wrapper so instructions are read on focus; aria-hidden on decorative body outline and FRONT/BACK Closes #70, #77, #83 Co-Authored-By: Claude Sonnet 4.6 --- app/src/components/ExerciseRow.jsx | 70 ++++++++++++++++++----------- app/src/components/MusclePicker.jsx | 10 +++-- 2 files changed, 49 insertions(+), 31 deletions(-) diff --git a/app/src/components/ExerciseRow.jsx b/app/src/components/ExerciseRow.jsx index 302d7a3..c16f47a 100644 --- a/app/src/components/ExerciseRow.jsx +++ b/app/src/components/ExerciseRow.jsx @@ -44,6 +44,7 @@ export default function ExerciseRow({ {editingName ? ( onChange({ name: e.target.value, standardName: e.target.value })} onBlur={() => setEditingName(false)} @@ -77,33 +78,48 @@ export default function ExerciseRow({
- {["sets", "reps"].map(field => ( -
- onChange({ [field]: e.target.value })} - style={{ - width: 40, - height: 28, - padding: "0 4px", - background: "var(--cds-field-01)", - border: `1px solid ${validateNumbers && isInvalidNum(exercise[field]) ? "var(--cds-support-error)" : "var(--cds-border-strong-01)"}`, - color: validateNumbers && isInvalidNum(exercise[field]) ? "var(--cds-support-error)" : "var(--cds-text-primary)", - fontFamily: "var(--cds-font-sans)", - fontSize: 12, - outline: "none", - textAlign: "center", - }} - /> - - {field === "sets" ? "sett" : "reps"} - -
- ))} + {["sets", "reps"].map(field => { + const isFieldInvalid = validateNumbers && isInvalidNum(exercise[field]); + const errorId = `err-${exercise.id}-${field}`; + return ( +
+ onChange({ [field]: e.target.value })} + style={{ + width: 40, + height: 28, + padding: "0 4px", + background: "var(--cds-field-01)", + border: `1px solid ${isFieldInvalid ? "var(--cds-support-error)" : "var(--cds-border-strong-01)"}`, + color: isFieldInvalid ? "var(--cds-support-error)" : "var(--cds-text-primary)", + fontFamily: "var(--cds-font-sans)", + fontSize: 12, + outline: "none", + textAlign: "center", + }} + /> + + {field === "sets" ? "sett" : "reps"} + + {isFieldInvalid && ( + + Ugyldig antall – skriv inn 1 til 99 + + )} +
+ ); + })}