Forced colours: pressed controls keep a Highlight outline; the popover's filled controls an edge
A pressed toolbar or inspector button showed nothing in forced colours (its tint and inset ring are dropped); it keeps a 2px Highlight outline. The popover's Invite, Copy and access select have a transparent border, which forced colours draw (review on #106). i2.mjs checks both under emulated forced colours, seen to fail without either. share-pop.mjs times the aria-busy check from the request rather than the click (a slow click raced it), and checks it is absent at 250ms too; seen to fail with no busy and with busy at once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+49
−8
fixtures/engines/i2.mjs+19 −0fixtures/engines/share-pop.mjs+12 −4internal/docs/brand/share-pop.css+8 −4internal/docs/views/show.html+10 −0
CI cancelled — superseded by a newer push — run details
diff --git a/fixtures/engines/i2.mjs b/fixtures/engines/i2.mjs| index 25988b2..bfa2bd2 100644 |
| --- a/fixtures/engines/i2.mjs |
| +++ b/fixtures/engines/i2.mjs |
| @@ -177,6 +177,25 @@ for (const engine of [chromium, webkit]) { |
| if (o.state !== 'open' || o.expanded !== 'true' || !o.inspector.drawn) fail(`1280: Format again left the inspector ${o.state}, aria-expanded ${o.expanded}, drawn ${o.inspector.drawn}`) |
| const openTab = await tabFromAccount() |
| if (openTab !== 'toolbar') fail(`1280: open, Tab from the account reached ${openTab}, want the toolbar`) |
| + |
| + // Forced colours (review on #106), where the engine can emulate them: |
| + // a pressed control keeps an outline, and the Share popover's filled |
| + // controls an edge. |
| + await page.emulateMedia({ forcedColors: 'active' }) |
| + if (await page.evaluate(() => matchMedia('(forced-colors: active)').matches)) { |
| + const pressed = await page.evaluate(() => { |
| + const b = document.querySelector('[docs-inspector] [aria-pressed="true"]') |
| + return b ? getComputedStyle(b).outlineStyle : 'no pressed control' |
| + }) |
| + if (pressed !== 'solid') fail(`forced colours: the pressed control's outline is ${pressed}, want solid`) |
| + await page.click('[estilo-bar-actions] a[href$="/share"]') |
| + await until(async () => (await page.locator('[docs-share-pop] [docs-share-panel]').count()) === 1) |
| + const edges = await page.evaluate(() => ['[docs-share-submit]', '[docs-share-invite] select'].map((sel) => { |
| + const el = document.querySelector(sel) |
| + return el ? `${sel} ${getComputedStyle(el).borderTopStyle} ${getComputedStyle(el).borderTopWidth}` : `${sel} missing` |
| + })) |
| + for (const e of edges) if (!e.endsWith('solid 1px')) fail(`forced colours: ${e}, want a 1px border`) |
| + } |
| await context.close() |
| } |
diff --git a/fixtures/engines/share-pop.mjs b/fixtures/engines/share-pop.mjs| index 892f586..ecbfe1a 100644 |
| --- a/fixtures/engines/share-pop.mjs |
| +++ b/fixtures/engines/share-pop.mjs |
| @@ -108,11 +108,13 @@ for (const engine of [chromium, webkit]) { |
| let mode = 'slow' |
| let posts = 0 |
| let finished = 0 |
| + let postAt = 0 |
| page.on('requestfinished', (r) => { if (r.method() === 'POST') finished++ }) |
| page.on('requestfailed', (r) => { if (r.method() === 'POST') finished++ }) |
| await page.route('**/share/**', async (route) => { |
| if (route.request().method() !== 'POST') return route.continue() |
| posts++ |
| + if (!postAt) postAt = Date.now() |
| if (mode === 'abort') return route.abort() |
| await pause(1500) |
| return route.continue() |
| @@ -123,14 +125,20 @@ for (const engine of [chromium, webkit]) { |
| const checked = (i) => rung(i).locator('input[type=checkbox]').isChecked() |
| const team = await checked(0) |
| const link = await checked(1) |
| - const t0 = Date.now() |
| + // Timed from the request, not the click, which can take a while to |
| + // land: no aria-busy at 250ms, and aria-busy by 650ms (the rule is |
| + // 500). |
| + const busyAt = async (ms) => { |
| + await until(async () => postAt > 0, 2000) |
| + await pause(Math.max(0, postAt + ms - Date.now())) |
| + return page.locator('[docs-share-rung] input[aria-busy="true"]').count() |
| + } |
| await rung(0).locator('[rst-switch]').click() |
| - await pause(150) |
| + if ((await busyAt(250)) !== 0) fail('the waiting switch said aria-busy before 500ms') |
| await rung(1).locator('[rst-switch]').click() |
| await pause(100) |
| if ((await checked(1)) !== link) fail('a second switch moved while the first one\'s request was in flight') |
| - await pause(Math.max(0, 750 - (Date.now() - t0))) |
| - if ((await page.locator('[docs-share-rung] input[aria-busy="true"]').count()) !== 1) fail('the waiting switch did not say aria-busy after 500ms') |
| + if ((await busyAt(650)) !== 1) fail('the waiting switch did not say aria-busy after 500ms') |
| const settled = await until(async () => finished === 1 && (await page.locator('[docs-share-pop] [aria-busy="true"]').count()) === 0 && (await checked(0)) !== team, 5000) |
| if (!settled) fail('the held request did not land and redraw the panel') |
| if (posts !== 1) fail(`${posts} requests were sent for one switch and one refused flip, want 1`) |
diff --git a/internal/docs/brand/share-pop.css b/internal/docs/brand/share-pop.css| index c86b31d..2fa718d 100644 |
| --- a/internal/docs/brand/share-pop.css |
| +++ b/internal/docs/brand/share-pop.css |
| @@ -124,9 +124,12 @@ |
| [docs-share-invite] select { |
| flex: none; |
| block-size: 28px; |
| + box-sizing: border-box; |
| padding-block: 0; |
| - padding-inline: 8px 22px; |
| - border: 0; |
| + padding-inline: 7px 21px; |
| + /* Transparent, not none: forced colours draw it, so the control keeps |
| + an edge there (review on #106). */ |
| + border: 1px solid transparent; |
| border-radius: 7px; |
| background-color: var(--rst-surface-2); |
| font: 500 12.5px var(--rst-font, system-ui), sans-serif; |
| @@ -144,9 +147,10 @@ |
| [docs-share-submit], |
| [docs-share-copy] { |
| flex: none; |
| + box-sizing: border-box; |
| block-size: 28px; |
| - padding: 0 14px; |
| - border: 0; |
| + padding: 0 13px; |
| + border: 1px solid transparent; |
| border-radius: 7px; |
| background: var(--rst-accent); |
| color: var(--rst-on-accent); |
diff --git a/internal/docs/views/show.html b/internal/docs/views/show.html| index 17732c2..3641e78 100644 |
| --- a/internal/docs/views/show.html |
| +++ b/internal/docs/views/show.html |
| @@ -1014,6 +1014,16 @@ |
| color: var(--rst-text-faint); |
| cursor: default; |
| } |
| + /* Forced colours drop the pressed tint and the inset ring (a box |
| + shadow), so a pressed control looked like every other: it keeps a |
| + Highlight outline there, in the strip and the inspector alike |
| + (review on #106). */ |
| + @media (forced-colors: active) { |
| + [docs-tool][aria-pressed="true"] { |
| + outline: 2px solid Highlight; |
| + outline-offset: -2px; |
| + } |
| + } |
| /* A button's name as a tooltip, drawn here rather than by the |
| browser's title attribute: Safari placed that one at the corner |
| of the window, far from the button, inside the blurred dock. The |