From 3de955c52a082558b98e9687c4e21855badc4a70 Mon Sep 17 00:00:00 2001 From: rays Date: Wed, 2 Dec 2026 12:22:22 -0500 Subject: [PATCH] Dimmed buttons say why; the directory fits at 200% zoom (#507) Checked against the style guide's design half: - Dimmed, not removed: the page already dims rather than hides, but a dimmed toolbar button kept its usual tooltip, so it looked broken. dim() sets the reason (Choose an item first, Open a feed to unsubscribe from it, Nothing to play in this item) and gives the usual tooltip back. The player's play-button sync leaves a dimmed one alone, and syncTools asks it to repaint so a playing item still says Pause. The admin page's Save says nothing has changed yet. - 200% zoom on a 320 px screen (160 CSS px): the app and admin page fit; the directory scrolled sideways, its name on one line, its header form beside it, its category grid at a 180 px minimum and the chart's words. Now its name wraps, the form takes its own line, the grid's minimum is the width, and long words break. - Tap targets at 320 px: the directory's tabs, chips, button and search box were 35-39 px, now 40; the page's checkbox rows were 26 px, now 40. The admin switches are iOS's 51x31 inside a taller row. - The directory's hovers sit inside (hover:hover). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RqkrVCCH8YcP2Y3i8VNYWA --- crates/directory/CHANGELOG.md | 1 + crates/directory/src/site.css | 22 +++++++++++++++------- tests/ui/app.spec.ts | 10 ++++++++++ web/CHANGELOG.md | 1 + web/app.css | 2 +- web/index.html | 8 ++++---- web/src/admin.ts | 6 +++--- web/src/dialogs.ts | 2 +- web/src/feedpage.ts | 2 +- web/src/items.ts | 12 ++++++------ web/src/player.ts | 4 +++- web/src/playlists.ts | 4 ++-- web/src/signals.ts | 2 +- web/src/util.ts | 4 ++++ 14 files changed, 53 insertions(+), 27 deletions(-) diff --git a/crates/directory/CHANGELOG.md b/crates/directory/CHANGELOG.md index a7ee065..5889046 100644 --- a/crates/directory/CHANGELOG.md +++ b/crates/directory/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- On a phone the directory's pages fit at 200% zoom without scrolling sideways, its tabs, buttons and search box are 40 px to tap, and a link does not stay underlined after a tap (#507). - An episode its feed gives no title is named by the opening of its text or else its file's name, where it had none (#502). - Its checks of YouTube channels go one at a time, two seconds apart, since YouTube refuses many asked together (#386). - Its JSON log lines no longer carry their span, once on its own and again in a list, which said nothing the line's own fields did not (#363). diff --git a/crates/directory/src/site.css b/crates/directory/src/site.css index 6d5d637..74b9496 100644 --- a/crates/directory/src/site.css +++ b/crates/directory/src/site.css @@ -6,7 +6,7 @@ html{-webkit-text-size-adjust:100%} body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif} a{color:var(--accent);text-decoration:none} -a:hover{text-decoration:underline} +@media (hover:hover){a:hover{text-decoration:underline}} a:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px} header{display:flex;align-items:center;gap:16px;padding:12px 20px;background:var(--panel);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:1} .brand{display:flex;align-items:center;gap:10px;color:var(--fg);font-weight:700;font-size:17px;white-space:nowrap} @@ -29,21 +29,21 @@ h3{font-size:17px;margin:28px 0 8px} /* A grid item is as wide as its content unless told otherwise, and a long title then runs off the page. */ .chart li,.tile{min-width:0} .chart a{display:flex;align-items:center;gap:12px;padding:8px;border-radius:10px;color:var(--fg)} -.chart a:hover{background:var(--panel);text-decoration:none} +@media (hover:hover){.chart a:hover{background:var(--panel);text-decoration:none}} .no{width:22px;text-align:right;color:var(--faint);font-variant-numeric:tabular-nums;flex:none} .txt{display:flex;flex-direction:column;min-width:0} .txt b,.tile b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap} small{color:var(--dim);font-size:13px} -.cats{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px} +.cats{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(180px,100%),1fr));gap:12px} .cat{display:flex;flex-direction:column;gap:2px;padding:14px 16px;border-radius:12px;background:var(--panel);border:1px solid var(--line);color:var(--fg)} -.cat:hover{border-color:var(--accent);text-decoration:none} +@media (hover:hover){.cat:hover{border-color:var(--accent);text-decoration:none}} .tabs,.pills{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 12px} .tabs a,.pills a{padding:6px 14px;border-radius:999px;background:var(--panel);border:1px solid var(--line);color:var(--fg);font-size:14px} .tabs a[aria-current],.pills a[aria-current]{background:var(--accent);border-color:var(--accent);color:var(--ink)} .pills a[aria-current] small{color:inherit} .tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:18px 14px} .tile{display:flex;flex-direction:column;gap:4px;min-width:0;color:var(--fg)} -.tile:hover{text-decoration:none}.tile:hover b{text-decoration:underline} +@media (hover:hover){.tile:hover{text-decoration:none}.tile:hover b{text-decoration:underline}} .show{display:flex;gap:24px;align-items:flex-end;margin-top:8px} .meta{display:flex;flex-direction:column;gap:6px;min-width:0;flex:1} .meta h2{margin:0;font-size:28px;line-height:1.15;overflow-wrap:anywhere} @@ -58,9 +58,17 @@ button{font:inherit;font-weight:600;padding:8px 16px;border-radius:10px;border:0 article{padding:12px 0;border-bottom:1px solid var(--line);max-width:80ch} article p{margin:4px 0;color:var(--dim)} @media (max-width:600px){ - header{padding:10px 16px;gap:10px} + header{padding:10px 16px;gap:10px;flex-wrap:wrap} + /* Under the name rather than squeezed beside it: at 200% zoom the two did not fit (#507). */ + header form{flex:1 1 100%} + /* 40 px to tap, as the style guide asks of a phone (#507). */ + .tabs a,.pills a{padding:9px 14px} + button,input{padding-top:10px;padding-bottom:10px} .brand span,.brand{font-size:15px} - main{padding:16px} + /* Its name may take two lines: on one, it ran past the edge at 200% zoom (#507). */ + .brand{white-space:normal} + /* A word too long for the line breaks rather than pushing the page sideways at 200% zoom (#507). */ + main{padding:16px;overflow-wrap:anywhere} .show{flex-direction:column;align-items:flex-start;gap:14px} .art.lg{width:140px} .tiles{grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:14px 10px} diff --git a/tests/ui/app.spec.ts b/tests/ui/app.spec.ts index 6de275a..2ed9a2e 100644 --- a/tests/ui/app.spec.ts +++ b/tests/ui/app.spec.ts @@ -53,6 +53,16 @@ test.beforeEach(async ({ page }) => { await expect(page.locator('#feedlist')).toBeVisible(); }); +test('a toolbar button that cannot act says why, and its usual tooltip comes back when it can (#507)', async ({ page }) => { + await page.locator('#feedlist .place', { hasText: 'All Subscriptions' }).click(); + await expect(page.locator('#tbRemove')).toBeDisabled(); + await expect(page.locator('#tbRemove')).toHaveAttribute('title', 'Open a feed to unsubscribe from it'); + await expect(page.locator('#tbRead')).toHaveAttribute('title', 'Choose an item first'); + await page.locator('#feedlist .feed', { hasText: 'Test Show' }).click(); + await expect(page.locator('#tbRemove')).toBeEnabled(); + await expect(page.locator('#tbRemove')).toHaveAttribute('title', 'Unsubscribe from this feed'); +}); + test('the page loads and lists the configured feeds', async ({ page }) => { // Regression: a ReferenceError in the script left the shell rendered and the sidebar // empty, with every handler below the error dead. Server-side checks all passed. diff --git a/web/CHANGELOG.md b/web/CHANGELOG.md index a8a9c71..b31d64c 100644 --- a/web/CHANGELOG.md +++ b/web/CHANGELOG.md @@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- A toolbar button that cannot act says why in its tooltip (Choose an item first, Open a feed to unsubscribe from it, Nothing to play in this item), and the admin page's Save says nothing has changed yet; on a phone a checkbox's row is 40 px to tap (#507). - On a phone the toolbar's buttons and the list's tabs are at least 40 px to tap, a chapter no longer stays lit after a tap, and an item's pin and download buttons have names a screen reader reads, as the style guide's design half asks (#507). - The page's words follow one style (docs/STYLE-GUIDE.md): failures say "Unable to …" and what to do, a podcast is a podcast rather than a show, a feed has an address rather than a URL, and the buttons Auto and Initials in a signal's icon picker read Pick for me and Use initials (#507). - A title that is only the opening of an item's own text, as ipx now names an untitled item, is not shown again above that text in the reader or a directory preview (#502). diff --git a/web/app.css b/web/app.css index f4468be..29395aa 100644 --- a/web/app.css +++ b/web/app.css @@ -1604,7 +1604,7 @@ body:has(#player.on) #status{padding-bottom:3px} dialog.ask{margin:auto 0 0;width:100%;max-width:100%} .card h3{font-size:22px} .field label,.field .hint{font-size:13px} - .check{font-size:17px} + .check{font-size:17px;min-height:40px} /* A feed's settings, at a phone's sizes. */ .card.fset{padding:0} .fsetbody{padding:20px 16px 24px} diff --git a/web/index.html b/web/index.html index 58d8e5c..31a2241 100644 --- a/web/index.html +++ b/web/index.html @@ -19,13 +19,13 @@
- +
- - - + + +
diff --git a/web/src/admin.ts b/web/src/admin.ts index 0d0ae32..ed376f6 100644 --- a/web/src/admin.ts +++ b/web/src/admin.ts @@ -63,9 +63,9 @@ async function drawServer(){ : 'This server has no TypeSafe key (TYPESAFE_KEY), so each person uses their own.'}

${anum('gsigdays', 'A new Signal looks back', g.signal_days, 'days', ' min="1" max="365"')}

Each item read is a call to TypeSafe, so a longer look back costs more, once for each new Signal.

`)} -
`; +
`; // Save waits for a change, so it says whether there is one. - box.oninput = () => { $('#gsave').disabled = false; }; + box.oninput = () => { dim($('#gsave'), null, 'Save'); }; $('#gsave').onclick = async () => { try{ await api('/api/settings', {method: 'PATCH', body: JSON.stringify({ @@ -79,7 +79,7 @@ async function drawServer(){ // Left alone while the server has no key to offer, rather than switched off. ...($('#gsig').disabled ? {} : {signals_on_server: $('#gsig').checked})})}); toast('Settings saved'); - $('#gsave').disabled = true; + dim($('#gsave'), 'Nothing changed yet', 'Save'); }catch(e){ toast(why(e), true); } }; } diff --git a/web/src/dialogs.ts b/web/src/dialogs.ts index f5a651b..134ba5d 100644 --- a/web/src/dialogs.ts +++ b/web/src/dialogs.ts @@ -303,7 +303,7 @@ function catTile(c: string,name: string,count: string,rows: DirFeed[]){ async function renderListed(v: {title: string, icon: string, url?: string, blurb?: string}){ const box=$('#content'); box.classList.add('plain'); - $('#tbRemove').disabled=true; + dim($('#tbRemove'),NO_FEED,UNSUB); syncTools(null); if(v===VIEWS[':directory']){ $('#epSearch').placeholder='Find a feed…'; diff --git a/web/src/feedpage.ts b/web/src/feedpage.ts index 7fc0680..aba0dfc 100644 --- a/web/src/feedpage.ts +++ b/web/src/feedpage.ts @@ -28,7 +28,7 @@ function renderFeed(){ if(pl) return renderPlaylist(pl); const f=v?null:S.feeds.find(x=>x.id===S.feed); const sg=signalOf(S.feed); - $('#tbRemove').disabled=!f; + dim($('#tbRemove'),f?null:NO_FEED,UNSUB); syncTools(null); if(!v&&!f&&!sg){ box.innerHTML='

Add a feed to get started.

'; $('#count').textContent=''; return; } const name=f?(f.title||f.id):sg?sg.name:v.title; diff --git a/web/src/items.ts b/web/src/items.ts index 37d5f12..68bf6ff 100644 --- a/web/src/items.ts +++ b/web/src/items.ts @@ -399,8 +399,12 @@ function dragSplit(pane: HTMLElement){ /// Which item the toolbar's play, read and keep buttons act on. const cur=()=>S.entries.find(x=>entryKey(x)===S.sel); function syncTools(e: Entry|null){ - $('#tbPlay').disabled=!(e&&e.enclosures.some(isPlayable)); - $('#tbRead').disabled=$('#tbFlag').disabled=!e; + const pick=e?null:'Choose an item first'; + dim($('#tbPlay'),pick??(e!.enclosures.some(isPlayable)?null:'Nothing to play in this item'),'Play the selected item'); + dim($('#tbRead'),pick,e?`Mark ${e.read?'unread':'read'}`:''); + dim($('#tbFlag'),pick,e?.flagged?'Unpin':'Pin, so it is never deleted'); + // The play button says Pause when the item chosen is the one playing. + syncPlayButtons(); // The same icons as the item's own buttons beside its title, so the two never disagree. Each // shows what is, as the pin always did: read showed what a click would do, so the two side by // side said opposite things (#74). The shape carries it, not the colour. @@ -408,10 +412,6 @@ function syncTools(e: Entry|null){ $('#tbRead').setAttribute('aria-pressed',String(!!(e&&e.read))); $('#tbFlag').setAttribute('aria-pressed',String(!!(e&&e.flagged))); $('#tbFlag').innerHTML=e&&e.flagged?ICON.pinOn:ICON.pin; - if(e){ - $('#tbRead').title=`Mark ${e.read?'unread':'read'}`; - $('#tbFlag').title=e.flagged?'Unpin':'Pin, so it is never deleted'; - } } /// The item's text in the pane below the list, and its files in the pane beside it. diff --git a/web/src/player.ts b/web/src/player.ts index 364277d..0420476 100644 --- a/web/src/player.ts +++ b/web/src/player.ts @@ -158,7 +158,9 @@ function syncPlayButtons(){ for(const b of $$('#eps .ep [data-a=play]')) paint(b,on(b.closest('.ep')!.dataset.key),'Play'); for(const b of $$('#files [data-a=play][data-enc], #detail [data-a=play][data-enc]')) paint(b,on(S.sel,Number(b.dataset.enc)),'Play'); - const e=cur(); paint($('#tbPlay'),!!e&&on(entryKey(e)),'Play the selected item'); + // Dimmed, it keeps the reason it is dimmed (#507). + const e=cur(), tb=$('#tbPlay'); + if(!tb.disabled) paint(tb,!!e&&on(entryKey(e)),'Play the selected item'); } for(const ev of ['play','pause','timeupdate']) audio.addEventListener(ev,syncListening); window.addEventListener('beforeunload',savePos); diff --git a/web/src/playlists.ts b/web/src/playlists.ts index 529587f..c87f621 100644 --- a/web/src/playlists.ts +++ b/web/src/playlists.ts @@ -37,7 +37,7 @@ function playlistFolder(list: HTMLElement, q: string){ /// The folder's page: every playlist, and New playlist. function renderPlaylists(){ $('#count').textContent=`Playlists: ${plural(playlists.length,'playlist')}`; - $('#tbRemove').disabled=true; + dim($('#tbRemove'),NO_FEED,UNSUB); syncTools(null); const box=$('#content'); box.classList.add('plain'); @@ -63,7 +63,7 @@ function renderPlaylists(){ /// A playlist's page: its episodes in its order. Play goes on through it; the cross marks one /// played, which takes it out of an unplayed-only playlist. async function renderPlaylist(p: Playlist){ - $('#tbRemove').disabled=true; + dim($('#tbRemove'),NO_FEED,UNSUB); syncTools(null); const box=$('#content'); box.classList.add('plain'); diff --git a/web/src/signals.ts b/web/src/signals.ts index c3efabf..348c819 100644 --- a/web/src/signals.ts +++ b/web/src/signals.ts @@ -74,7 +74,7 @@ function signalFolder(list: HTMLElement, q: string){ function renderSignals(){ const unread=S.signals.reduce((k,s)=>k+s.unread,0); $('#count').textContent=`Signals: ${plural(S.signals.length,'signal')}, ${unread} unread`; - $('#tbRemove').disabled=true; + dim($('#tbRemove'),NO_FEED,UNSUB); syncTools(null); const box=$('#content'); box.classList.add('plain'); diff --git a/web/src/util.ts b/web/src/util.ts index 1295e9f..5e699a5 100644 --- a/web/src/util.ts +++ b/web/src/util.ts @@ -272,6 +272,10 @@ async function sendLink(title: string, url: string, btn?: HTMLElement){ toast('Link copied'); } +/// A button that cannot act now is dimmed in place, its tooltip saying why, and gets its usual +/// tooltip back when it can (#507): dimmed with its usual one, it looked broken. +function dim(b: HTMLButtonElement, why: string|null, usual: string){ b.disabled=!!why; b.title=why??usual; } +const NO_FEED='Open a feed to unsubscribe from it', UNSUB='Unsubscribe from this feed'; function toast(msg: string, bad?: boolean){ const t=document.createElement('div'), box=$('#toasts'); t.className='toast'+(bad?' bad':''); t.textContent=msg;