diff --git a/docs/waves/backlog.md b/docs/waves/backlog.md index 1e367bc..01e3600 100644 --- a/docs/waves/backlog.md +++ b/docs/waves/backlog.md @@ -696,6 +696,8 @@ deliberately deferred. - **Suggested wave or follow-up:** wave 14, alongside T14.1's badge changes: do not show the badge on pages with nothing to sync, and keep it clear of page controls. +- **Status:** fixed at T14.3 (2026-10-17). The console pages never show the badge, "Everything sent" shows only + after real work, and the badge moves to a free spot. One dense-screen case is left: BL-072. ### BL-069 - The sync has no cap on one run and no last-admin guard @@ -838,3 +840,16 @@ boundary"). Do not use `localStorage` as the store of record. - **Why not now:** it is a test-script quirk and not part of D18. The documented usage lines show `http://localhost:8000`. - **Suggested wave or follow-up:** next housekeeping pass: use the domain `localhost.local` for a dotless host, or change the usage lines to `127.0.0.1`. + +### BL-072 - The sync badge can cover a control on a very dense screen + +- **Found during:** T14.3 (D26, BL-061) +- **Where:** `html/project-data.js` `placeBadge()`; seen on `wp-creation-index.html` at 390px +- **What:** the badge looks for a free spot on the screen, and it covers no control when the screen has room for it. + With the longest state (a change refused by the project, with a long reason) on the creator page at 390px, no free + spot of that size exists. The badge then covers the one control it overlaps least ("Load sample data" at the + time of the check). The person can press Dismiss, or scroll (the badge moves again within 2 seconds). +- **Why not now:** a fixed overlay cannot fix a screen with no gap. The real fix is a layout change: a bar that + takes its own space in the page, or a place for it in the shared header. That is a design decision for all pages, + not part of T14.3. +- **Suggested wave or follow-up:** decide with Nick whether the shared page layout reserves a status line. diff --git a/docs/waves/wave-14.md b/docs/waves/wave-14.md index 7e4434d..624c11d 100644 --- a/docs/waves/wave-14.md +++ b/docs/waves/wave-14.md @@ -106,7 +106,7 @@ badge is a `div` with `pointer-events:none`. A badge that must ask a person to s - [x] opening the app offline before the time works; opening it offline after the time gives read-and-queue mode and does not redirect - [x] online with a dead session: redirect to `login.html?next=...`, queue kept, changes sent after sign-in (the send after sign-in is the T14.1 test, section 3) - [x] a page load does not extend the cached window -- [ ] the mode line is announced by a screen reader (`aria-live`) and fits at 390 px. The line is in the badge, which has `role="status"` (checked). It is **not** checked at 390 px or with a real screen reader. Do this in T14.3, which rebuilds the badge. +- [x] the mode line is announced by a screen reader (`aria-live`) and fits at 390 px. The line is in the badge, which has `role="status"`. T14.3 checks that it fits at 390 px and covers no control (`sync_badge_check.py`, state `readqueue`). It was **not** tried with a real screen reader. **Built (2026-10-17):** `tests/session_expiry_check.py` (22 checks) fails when the old 12 hour rule is put back (7 failures). The mode line shows only in read-and-queue mode, not when the app opens offline before the session ends, because "sign in again" would be wrong while the session is still good. In read-and-queue mode the outbox does not send at all until a page load gets a good answer from the server. Saving display preferences refreshes the cached user and keeps the end time (`wpCacheAuth`). @@ -134,12 +134,14 @@ badge is a `div` with `pointer-events:none`. A badge that must ask a person to s **Done when:** -- [ ] each state shows in a browser test, with its text, at 390 px and 1440 px -- [ ] "Sign in" works with the keyboard and by touch, and goes to `login.html?next=...` -- [ ] the badge covers no control on the User Directory at 1440 px or the bulk bar at 390 px (the two places `BL-061` named) -- [ ] no badge on the console pages -- [ ] the contrast check passes for every state -- [ ] `autosave_check.py` and `a11y_check.py` pass +- [x] each state shows in a browser test, with its text (`tests/sync_badge_check.py`). The states are checked at 1440 px; the placement is checked at 390 px and 1440 px +- [x] "Sign in" is a real link (``), reachable by keyboard, 44 px or more, with a focus ring, and goes to `login.html?next=...`. Touch is covered by the size and by the element type: no touch event was sent +- [x] the badge covers no control on the User Directory or the bulk bar: the console pages never show it (`data-wp-no-sync-badge`) +- [x] no badge on the console pages +- [x] the contrast check passes for every state (4.5:1 or better, light theme only; the dark theme was **not** checked) +- [x] `autosave_check.py` and `a11y_check.py` pass. Full suite 2026-10-17: 53 of 55 pass; `generalinfo_check` and `token_check` fail as before (known, not regressions). `sync_badge_check.py` (87 checks) fails when the "nothing to send" rule and the console opt-out are removed (3 failures) + +**Built (2026-10-17):** the badge words are in one function, `badgeModel()`. The mode line for read-and-queue mode now says "...to send your changes to the project." so it follows the B5 rule. "Dismiss" removes only the changes the project refused, after the person presses it. The badge picks a free spot on the screen (BL-061). One case is left, a very dense screen with no free gap: `BL-072`. No before and after screenshots were taken: the check measures overlap in the browser instead. A person should look at the badge once on a phone. --- diff --git a/html/admin.html b/html/admin.html index e585a6c..82a3b92 100644 --- a/html/admin.html +++ b/html/admin.html @@ -58,7 +58,7 @@ } - +
diff --git a/html/project-data.js b/html/project-data.js index 7224a53..bc93106 100644 --- a/html/project-data.js +++ b/html/project-data.js @@ -423,79 +423,212 @@ renderSyncBadge(c); } - // Tiny sync indicator (bottom-left). This was gated on being the top-level - // window so it was not drawn twice - once by the suite page and again inside - // the embedded creator. B7/T7.1 dissolved that frame, so there is one document - // and one badge. The 'storage' listener below stays: it is what keeps two - // TABS in step, which is a different thing and still happens. - var _badgeHideTimer = null; + // The sync badge (D26, BL-061). It reports the OUTBOX: whether saved records have + // reached the project. This was gated on being the top-level window so it was not + // drawn twice (the suite page and the embedded creator); B7/T7.1 dissolved that + // frame, so there is one document and one badge. The 'storage' listener below + // stays: it is what keeps two TABS in step, which is a different thing. + var _badgeHideTimer = null, _badgePlaceTimer = null, _hadWork = false; // BL-011 (fixed at T9.9): the badge used to mount on the FIRST SYNC EVENT, // which is async, so the three fixed overlays on the SOP page landed in a // different DOM order run to run and every index-keyed comparison saw // phantom diffs. Mounting the (hidden) holder at DOMContentLoaded puts the // three in script order, deterministically. document.addEventListener('DOMContentLoaded', function () { renderSyncBadge(null); }); + + // BL-061: the console pages (Admin, User Directory) never queue project work, and + // the badge used to sit over their bottom-right buttons. They opt out with + // data-wp-no-sync-badge on . + function badgeExempt() { return !!(document.body && document.body.hasAttribute('data-wp-no-sync-badge')); } + + // Discard the changes the project refused. The person has read the reason and + // chose to dismiss it; nothing else ever removes a queued change by itself. + function dismissRejected() { + _mem = _mem.filter(function (o) { return !o.dead; }); + qWrite(qRead().filter(function (o) { return !o.dead; })); + notifySync(); + } + function signInUrl() { + return 'login.html?next=' + encodeURIComponent(location.pathname + location.search); + } + + // One place decides what the badge says. B5: every string names the PROJECT, so it + // cannot be read as the draft indicator (WPAutosave.mountIndicator), which speaks + // for the form. tone is one of neutral, ok, warn, error. + function badgeModel(c) { + var n; + if (c.deviceFull) { + n = c.unsaved; + return { tone: 'error', text: '✕ ' + n + ' change' + (n === 1 ? ' is' : 's are') + ' not saved on this device. Keep this page open until it is sent to the project.' }; + } + if (readQueueMode()) { + return { tone: 'warn', text: 'Working offline. Sign in again when you have a signal to send your changes to the project.', signIn: true }; + } + if (c.held) { + return { tone: 'warn', text: '⚠ Sign in again to send your changes to the project. They are kept on this device.', signIn: true }; + } + if (c.dead) { + return { tone: 'error', text: '✕ ' + c.dead + ' change' + (c.dead === 1 ? '' : 's') + ' rejected by the project. Not saved.', reason: c.reason, dismiss: true }; + } + if (c.failed) { + return { tone: 'warn', text: '⚠ ' + c.failed + ' change' + (c.failed === 1 ? '' : 's') + ' not yet sent to the project. Retrying.' }; + } + if (c.pending) { + return { tone: 'neutral', text: '↻ Sending ' + c.pending + ' change' + (c.pending === 1 ? '' : 's') + ' to the project…' }; + } + if (c.others) { + return { tone: 'warn', text: '⚠ ' + c.others + ' change' + (c.others === 1 ? ' belongs' : 's belong') + ' to ' + c.otherOwner + '. ' + (c.others === 1 ? 'It goes' : 'They go') + ' to the project when ' + c.otherOwner + ' signs in.' }; + } + // Nothing to report. "Everything sent" follows real work only: on a page that + // never queued anything it is noise that sits over the controls (BL-061). + if (!_hadWork) return null; + return { tone: 'ok', text: '✓ Everything sent to the project', autoHide: true }; + } + + var TONES = { + neutral: ['var(--cds-text-secondary)', 'var(--cds-border-subtle)', 'var(--cds-layer)'], + ok: ['var(--wp-status-success-text)', 'var(--wp-status-success-border-a)', 'var(--wp-status-success-bg)'], + warn: ['var(--wp-status-warning-text)', 'var(--cds-support-warning)', 'var(--wp-status-warning-bg)'], + error: ['var(--wp-status-error-text)', 'var(--wp-status-error-border-a)', 'var(--wp-status-error-bg)'] + }; + + function ensureBadgeStyle() { + if (document.getElementById('wp-sync-badge-style')) return; + var st = document.createElement('style'); + st.id = 'wp-sync-badge-style'; + // Controls are real and