chrome: a public page's brand is not drawn in the accent
Fable on c56314e, LOW: with an empty App.Home the brand is a plain-text span, and the compact bar drew it in the accent, so it looked like a link with nowhere to go. Only a[estilo-bar-brand] takes the accent now (TestOnlyALinkedBrandTakesTheAccent). The browser check loads the phone page with App.Home empty and compares the brand's colour with the accent's: equal on c56314e, different here. Where a public page's Sign in sits in the compact row is left to Docs' P1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+47
−2
chrome/chrome.css+3 −1chrome/compact.browser.mjs+15 −1chrome/compact_browser_test.go+12 −0chrome/compact_test.go+17 −0
diff --git a/chrome/chrome.css b/chrome/chrome.css| index b7f230a..39edf1b 100644 |
| --- a/chrome/chrome.css |
| +++ b/chrome/chrome.css |
| @@ -913,10 +913,12 @@ |
| min-block-size: 44px; |
| padding-inline: 0 var(--rst-sp-2); |
| border-radius: 999px; |
| - color: var(--rst-accent); |
| font-size: 1.0625rem; |
| font-weight: 400; |
| } |
| + /* Only a link is drawn in the accent: on a public page the brand is |
| + plain text (App.Home empty) and has no Back. */ |
| + [estilo-bar~="compact"] a[estilo-bar-brand] { color: var(--rst-accent); } |
| [estilo-bar~="compact"] [estilo-bar-brand] img { display: none; } |
| [estilo-bar~="compact"] [estilo-bar-brand] [estilo-bar-name] { display: inline; } |
| /* The bar's own title fills the room between Back and the end group, |
diff --git a/chrome/compact.browser.mjs b/chrome/compact.browser.mjs| index 8255072..b765d3a 100644 |
| --- a/chrome/compact.browser.mjs |
| +++ b/chrome/compact.browser.mjs |
| @@ -128,7 +128,21 @@ for (const engine of job.engines) { |
| entry.folded = await page.evaluate(large) |
| if (job.shots) await page.screenshot({ path: file('-folded') }) |
| } |
| - result.cases.push(entry) |
| + if (c.kind === 'phone' && c.lang === 'en' && c.scheme === 'light') { |
| + await page.goto(`${job.origin}/?lang=en&scheme=light&public=1`, { waitUntil: 'load' }) |
| + entry.public = await page.evaluate(() => { |
| + const probe = document.createElement('span') |
| + probe.style.color = 'var(--rst-accent)' |
| + document.body.append(probe) |
| + const accent = getComputedStyle(probe).color |
| + probe.remove() |
| + return { brand: getComputedStyle(document.querySelector('[estilo-bar-brand]')).color, accent } |
| + }) |
| + if (job.shots) await page.screenshot({ path: file('-public') }) |
| + } else { |
| + entry.public = { brand: 'n/a', accent: '' } |
| + } |
| + result.cases.push(entry) |
| await ctx.close() |
| } catch (e) { |
| result.cases.push({ name: c.name, width: c.w, touch: c.touch, error: String(e && e.message || e).split('\n')[0] }) |
diff --git a/chrome/compact_browser_test.go b/chrome/compact_browser_test.go| index 0bfcc2c..b4bd925 100644 |
| --- a/chrome/compact_browser_test.go |
| +++ b/chrome/compact_browser_test.go |
| @@ -157,6 +157,12 @@ type compactCase struct { |
| // The large-title idiom (Compact.Title), at rest and folded. |
| Rest largeTitle `json:"rest"` |
| Folded largeTitle `json:"folded"` |
| + // A public page's brand (App.Home empty): its colour and the |
| + // accent's. |
| + Public struct { |
| + Brand string `json:"brand"` |
| + Accent string `json:"accent"` |
| + } `json:"public"` |
| } `json:"cases"` |
| StandIns []standInCase `json:"standIns"` |
| } |
| @@ -197,6 +203,9 @@ func TestTheCompactBarInRealEngines(t *testing.T) { |
| if kind := r.URL.Query().Get("kind"); kind != "" { |
| b = standIn(kind, L) |
| } |
| + if r.URL.Query().Get("public") != "" { |
| + b.App.Home = "" |
| + } |
| if r.URL.Query().Get("inline") != "" { |
| b.Compact.Title = template.HTML(`<div demo-inline><b dir="auto">` + template.HTMLEscapeString(L["title"]) + `</b><small>` + template.HTMLEscapeString(L["sub"]) + `</small></div>`) |
| } |
| @@ -294,6 +303,9 @@ func TestTheCompactBarInRealEngines(t *testing.T) { |
| if len(c.Folded.Back) == 4 && (c.Folded.Back[2] < 43.5 || c.Folded.Back[3] < 43.5) { |
| t.Errorf("%s: folded, Back is %.1fx%.1fpx, under 44", where, c.Folded.Back[2], c.Folded.Back[3]) |
| } |
| + if c.Public.Brand == "" || c.Public.Brand == c.Public.Accent { |
| + t.Errorf("%s: a public page's plain-text brand is %q, the accent %q: it looks like a link", where, c.Public.Brand, c.Public.Accent) |
| + } |
| if !c.Folded.Title || c.Folded.Name > 1 || strings.TrimSpace(c.Folded.Label) == "" { |
| t.Errorf("%s: folded, the compact title shows %v, Back's name is %.1fpx wide and Back reads %q", where, c.Folded.Title, c.Folded.Name, c.Folded.Label) |
| } |
diff --git a/chrome/compact_test.go b/chrome/compact_test.go| index 2ed3960..45e2971 100644 |
| --- a/chrome/compact_test.go |
| +++ b/chrome/compact_test.go |
| @@ -315,6 +315,23 @@ func TestFoldedBackIsA44pxTarget(t *testing.T) { |
| } |
| } |
| +// A public page's brand is plain text, not a link: it is not drawn in the |
| +// link's accent (Fable, item 4). |
| +func TestOnlyALinkedBrandTakesTheAccent(t *testing.T) { |
| + src := string(CSS()) |
| + src = src[strings.Index(src, "/* ── Compact"):] |
| + for _, m := range regexp.MustCompile(`([^{};]+)\{([^}]*)\}`).FindAllStringSubmatch(src, -1) { |
| + if !strings.Contains(m[2], "var(--rst-accent)") || !strings.Contains(m[1], "[estilo-bar-brand]") { |
| + continue |
| + } |
| + for _, sel := range splitSelectors(strings.TrimSpace(m[1])) { |
| + if strings.HasSuffix(sel, "[estilo-bar-brand]") && !strings.HasSuffix(sel, "a[estilo-bar-brand]") { |
| + t.Errorf("%q draws a plain-text brand in the accent", sel) |
| + } |
| + } |
| + } |
| +} |
| + |
| // A compact bar fits 360px with room for the title: Back, the lead and a |
| // two-button trail are 300px in the mock-up, and the bar's own padding |
| // and gaps are the small steps. |