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.

Settings sub-pages: the back button shows its whole label and is named by it

Duarte Santos293392b9e463
diff --git a/frontend/src/index.css b/frontend/src/index.css
index caaf3fb50..5747a8bf5 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1873,11 +1873,14 @@ body.no-tabbar.resting #toast{bottom:calc(100px + var(--sab))}
@media (hover:hover){.dw-it:hover{color:var(--label)}}
/* ------------------------------------------------------- Settings (v1.3.11) -- */
-/* A sub-page's nav bar: the back button names where it goes, the title sits in the middle. */
-.sp-nav{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,max-content) minmax(0,1fr);align-items:center;column-gap:6px;
+/* A sub-page's nav bar: the back button names where it goes, the title sits in the middle.
+ The back column is at least as wide as its label ("Einstellungen" stays whole), and the two
+ side columns share what is left equally, so the title is centred whenever it can be and moves
+ over when the label needs the room. Only a label past half the screen is cut. */
+.sp-nav{display:grid;grid-template-columns:minmax(max-content,1fr) minmax(0,max-content) minmax(0,1fr);align-items:center;column-gap:6px;
min-height:44px;margin:4px -6px 10px}
.sp-back{display:inline-flex;align-items:center;gap:2px;color:var(--acc);font-size:17px;padding:6px;border-radius:10px;
- min-width:0;max-width:100%;justify-self:start}
+ min-width:0;max-width:50vw;justify-self:start}
.sp-back span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sp-back .icn{font-size:22px;--icon-stroke:2.2;flex:none}
.sp-title{text-align:center;font-weight:600;font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0}
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index 7d9f01d38..c3fb49b93 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -821,7 +821,9 @@ export default function Settings({ page = null, find = null }) {
const parent = PAGES[page].parent
return <div className="narrow" ref={body}>
<div className="sp-nav">
- <button className="sp-back" onClick={back} aria-label={t('Back')}>
+ {/* Named by what it says ("Settings", "Workout"), so a voice command for the visible
+ word finds it; the chevron is hidden from assistive tech. */}
+ <button className="sp-back" onClick={back}>
<Icon name="chevronLeft" /><span>{parent ? t(PAGES[parent].title) : t('Settings')}</span>
</button>
<h1 className="sp-title">{t(PAGES[page].title)}</h1>
diff --git a/frontend/src/views/settings-pages.test.jsx b/frontend/src/views/settings-pages.test.jsx
index 60652e3bc..f5cc46f63 100644
--- a/frontend/src/views/settings-pages.test.jsx
+++ b/frontend/src/views/settings-pages.test.jsx
@@ -173,6 +173,7 @@ describe('the pages', () => {
it('a sub-page names where back goes; Fine-tuning goes back to Workout', () => {
mount('alerts')
expect(host.querySelector('.sp-back').textContent).toBe('Settings')
+ expect(host.querySelector('.sp-back').hasAttribute('aria-label')).toBe(false) // its name is the word it shows
expect(host.querySelector('.sp-title').textContent).toBe('Timer alerts')
mount('advanced')
expect(host.querySelector('.sp-back').textContent).toBe('Workout')