Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Workout: set ticks say which set they finish to screen readers

Duarte Santos8270888cc9cb
diff --git a/frontend/src/components/ui.jsx b/frontend/src/components/ui.jsx
index 28e292b71..5e179747a 100644
--- a/frontend/src/components/ui.jsx
+++ b/frontend/src/components/ui.jsx
@@ -280,11 +280,12 @@ export function Slider({ value, min = 0, max = 100, step = 1, onChange, classNam
/* ============================ checkbox ============================ */
-export function Check({ checked, onChange, className = '', size }) {
+export function Check({ checked, onChange, className = '', size, label }) {
return (
<button
role="checkbox"
aria-checked={!!checked}
+ aria-label={label}
className={'chk' + (checked ? ' on' : '') + ' ' + className}
style={size ? { width: size, height: size } : null}
onClick={() => onChange(!checked)}
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 5391baa06..00fd10fde 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {
// has to be taught is a number nobody reads. What the numbers stood for is asserted above.
// If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('d33fb42b34f4c5325a1a8f05b08a4686fe7b2f23d05c5e30a77cf840e0f384d7')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('f2816f72d10ac570cceec1f6e00eb0d0310b0a7691daf33a25c85988deca8fff')
})
test('does not leak European Portuguese UI terms', () => {
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index f8493053a..f5efd656b 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1957,4 +1957,6 @@ export default {
'That took a little too long. Give it another go.': 'استغرق ذلك وقتًا أطول قليلًا من اللازم. جرّب مرة أخرى.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'لم ينجح هذا الرمز. الرموز صالحة لمدة 5 دقائق ولمرة واحدة فقط، فاطلب رمزًا جديدًا.',
'Create profile with a password': 'إنشاء ملف شخصي بكلمة مرور',
+ 'Set {0} done': 'المجموعة {0} مكتملة',
+ 'Set {0} ({1}) done': 'المجموعة {0} ({1}) مكتملة',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 418141d63..1190f3426 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1924,4 +1924,6 @@ export default {
'That took a little too long. Give it another go.': 'Das hat etwas zu lange gedauert. Versuch es gleich noch mal.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Der Code hat nicht geklappt. Codes gelten 5 Minuten und nur einmal, also hol dir einen frischen.',
'Create profile with a password': 'Profil mit Passwort erstellen',
+ 'Set {0} done': 'Satz {0} erledigt',
+ 'Set {0} ({1}) done': 'Satz {0} ({1}) erledigt',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index aa5c2d292..0306bd838 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': 'Eso tardó un poco de más. Inténtalo otra vez.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Ese código no funcionó. Los códigos duran 5 minutos y sirven una sola vez, así que pide uno nuevo.',
'Create profile with a password': 'Crear perfil con contraseña',
+ 'Set {0} done': 'Serie {0} hecha',
+ 'Set {0} ({1}) done': 'Serie {0} ({1}) hecha',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 060ce9be2..32d16c071 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': 'C’était un peu trop long. Réessaie.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Ce code n’a pas marché. Un code dure 5 minutes et ne sert qu’une fois, alors prends-en un tout neuf.',
'Create profile with a password': 'Créer un profil avec un mot de passe',
+ 'Set {0} done': 'Série {0} faite',
+ 'Set {0} ({1}) done': 'Série {0} ({1}) faite',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 43436d6ca..62e5eb7af 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': 'इसमें थोड़ा ज़्यादा समय लग गया। एक बार फिर कोशिश करें।',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'यह कोड काम नहीं किया। कोड 5 मिनट चलते हैं और सिर्फ़ एक बार काम करते हैं, तो एक नया कोड ले लें।',
'Create profile with a password': 'पासवर्ड के साथ प्रोफ़ाइल बनाएँ',
+ 'Set {0} done': 'सेट {0} पूरा',
+ 'Set {0} ({1}) done': 'सेट {0} ({1}) पूरा',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index e78065e09..abf826a8c 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1907,4 +1907,6 @@ export default {
'That took a little too long. Give it another go.': 'Ez egy kicsit túl sokáig tartott. Próbáld újra.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Ez a kód nem működött. A kódok 5 percig érvényesek és csak egyszer használhatók, úgyhogy kérj egy újat.',
'Create profile with a password': 'Profil létrehozása jelszóval',
+ 'Set {0} done': '{0}. sorozat kész',
+ 'Set {0} ({1}) done': '{0}. sorozat ({1}) kész',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 16d95fa4d..5c4a90e4d 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': 'Ci è voluto un po’ troppo. Riprova.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Questo codice non ha funzionato. I codici durano 5 minuti e valgono una volta sola, quindi prendine uno nuovo.',
'Create profile with a password': 'Crea profilo con password',
+ 'Set {0} done': 'Serie {0} fatta',
+ 'Set {0} ({1}) done': 'Serie {0} ({1}) fatta',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 266878f80..5b74043f0 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': '조금 너무 오래 걸렸어요. 다시 해 보세요.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': '이 코드는 안 됐어요. 코드는 5분 동안 한 번만 쓸 수 있으니 새 코드를 받아 주세요.',
'Create profile with a password': '비밀번호로 프로필 만들기',
+ 'Set {0} done': '{0}세트 완료',
+ 'Set {0} ({1}) done': '{0}세트({1}) 완료',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 3977ab68b..11d65a682 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': 'Trwało to trochę za długo. Spróbuj jeszcze raz.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Ten kod nie zadziałał. Kody są ważne 5 minut i działają raz, więc weź świeży.',
'Create profile with a password': 'Utwórz profil z hasłem',
+ 'Set {0} done': 'Seria {0} zrobiona',
+ 'Set {0} ({1}) done': 'Seria {0} ({1}) zrobiona',
}
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 1a7428554..6bb674bc8 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': 'Demorou um bocadinho demais. Tenta outra vez.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Esse código não funcionou. Os códigos duram 5 minutos e só servem uma vez, por isso pede um novo.',
'Create profile with a password': 'Criar perfil com palavra-passe',
+ 'Set {0} done': 'Série {0} concluída',
+ 'Set {0} ({1}) done': 'Série {0} ({1}) concluída',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 8c11c76e0..584ff0362 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1908,4 +1908,6 @@ export default {
'That took a little too long. Give it another go.': 'Это заняло слишком много времени. Попробуйте ещё раз.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Этот код не сработал. Коды действуют 5 минут и только один раз, так что возьмите свежий.',
'Create profile with a password': 'Создать профиль с паролем',
+ 'Set {0} done': 'Подход {0} выполнен',
+ 'Set {0} ({1}) done': 'Подход {0} ({1}) выполнен',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 215b5b498..da7dcb2da 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1915,4 +1915,6 @@ export default {
'That took a little too long. Give it another go.': 'ใช้เวลานานไปหน่อย ลองอีกครั้งนะ',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'รหัสนี้ใช้ไม่ได้ รหัสใช้ได้ 5 นาทีและใช้ได้ครั้งเดียว ขอรหัสใหม่นะ',
'Create profile with a password': 'สร้างโปรไฟล์ด้วยรหัสผ่าน',
+ 'Set {0} done': 'เซ็ต {0} เสร็จแล้ว',
+ 'Set {0} ({1}) done': 'เซ็ต {0} ({1}) เสร็จแล้ว',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 242b78114..2b60f7335 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': 'Bu biraz fazla uzun sürdü. Bir kez daha dene.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Bu kod işe yaramadı. Kodlar 5 dakika geçerli ve tek kullanımlık, yenisini al.',
'Create profile with a password': 'Şifreyle profil oluştur',
+ 'Set {0} done': 'Set {0} tamam',
+ 'Set {0} ({1}) done': 'Set {0} ({1}) tamam',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index ed94e47e4..e9bb97a52 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1901,4 +1901,6 @@ export default {
'That took a little too long. Give it another go.': 'Це тривало трохи задовго. Спробуйте ще раз.',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Цей код не спрацював. Коди діють 5 хвилин і лише один раз, тож візьміть свіжий.',
'Create profile with a password': 'Створити профіль з паролем',
+ 'Set {0} done': 'Підхід {0} виконано',
+ 'Set {0} ({1}) done': 'Підхід {0} ({1}) виконано',
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 6f9f885b7..fb118677d 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -1897,4 +1897,6 @@ export default {
'That took a little too long. Give it another go.': '花的時間有點太久了。再試一次吧。',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': '這個代碼沒用。代碼只在 5 分鐘內有效,而且只能用一次,換個新的吧。',
'Create profile with a password': '用密碼建立個人檔案',
+ 'Set {0} done': '第 {0} 組完成',
+ 'Set {0} ({1}) done': '第 {0} 組({1})完成',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 5383c8358..74505b21b 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1904,4 +1904,6 @@ export default {
'That took a little too long. Give it another go.': '花的时间有点太长了。再试一次吧。',
'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': '这个代码没用。代码只在 5 分钟内有效,且只能用一次,换个新的吧。',
'Create profile with a password': '用密码创建个人资料',
+ 'Set {0} done': '第 {0} 组完成',
+ 'Set {0} ({1}) done': '第 {0} 组({1})完成',
}
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index dc6c387f6..653603f65 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -514,7 +514,7 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
{sideCell(sd, i, side, col1, 'w')}
{col2 && sideCell(sd, i, side, col2, 'r')}
{col3 && sideEffortCell(sd, i, side, col3)}
- <Check checked={sd.done} onChange={() => onToggleSide(i, side)} />
+ <Check checked={sd.done} label={t('Set {0} ({1}) done', setNumOf(s, i), side === 'L' ? t('Left') : t('Right'))} onChange={() => onToggleSide(i, side)} />
</div>
}
// A side's own drop-set/rest-pause sub-rows (issue #60): the intensifier is logged per limb, so
@@ -655,7 +655,7 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
set off itself. The checkbox stays for anyone who timed it on their own watch. */}
{timed && !editing && <button className="setgo" aria-label={t('Start set')} disabled={s.done || !!working}
onClick={() => onStartTimed(i)}><Icon name="play" /></button>}
- <Check checked={s.done} onChange={() => onToggle(i)} />
+ <Check checked={s.done} label={sideTagOf(s) ? t('Set {0} ({1}) done', setNumOf(s, i), sideTagOf(s)) : t('Set {0} done', setNumOf(s, i))} onChange={() => onToggle(i)} />
</div>
)}
{loadLine(String(i))}
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index e52af29cc..4c7d78694 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -510,6 +510,14 @@ describe('Workout set completion flow', () => {
})
})
+describe('set ticks for screen readers', () => {
+ it('names each tick by its set, not just "checkbox"', async () => {
+ await mount([exercise('named-ticks', [false, false])])
+ const labels = [...container.querySelectorAll('[role="checkbox"]')].map(c => c.getAttribute('aria-label'))
+ expect(labels).toEqual(['Set 1 done', 'Set 2 done'])
+ })
+})
+
describe('Workout add exercise flow', () => {
it.each([
['freestyle', {}],