oficina / base Public

Show the glance as a status: italic, secondary ink, dots after

Paul read a glance ("Yo, Paul.") in the thinking bubble as a finished
reply. Glance and activity lines now read as a status: secondary ink
(--haze), italic, and the three soft dots after the words, still
shimmering (static with reduced motion; hidden from assistive tech).
The spark stays on the edge. The style sits on the .say span, so a
fading glance keeps it while the reply crossfades in, upright and in
full ink. One line, constant height and width-only-grows still hold:
the words end in the ellipsis and the dots always show.

TestAskGlanceReadsAsStatus checks the glance's style and dots in dark,
light and reduced motion, its contrast (9.2:1 dark, 7.6:1 light), and
that the reply is upright, full ink and dotless.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev f447db112ff95369f69f469508d75c496b25eb16 parent eb7ce35
3 files changed, +97 −11
  • internal/browsertest/thinking_test.go +78 −5
  • internal/look/static/app.css +7 −2
  • internal/look/static/ask.js +12 −4
diff --git a/internal/browsertest/thinking_test.go b/internal/browsertest/thinking_test.go
index 006db00..ff99958 100644
--- a/internal/browsertest/thinking_test.go
+++ b/internal/browsertest/thinking_test.go
@@ -431,9 +431,9 @@ func TestAskGlance(t *testing.T) {
th.wait(`(() => { const l = document.querySelector(` + strconv.Quote(thinkingSel+" .think-line") + `);
return l && l.getAnimations({ subtree: true }).some(a => a.playState === "running" && a.effect.target.textContent === ` + strconv.Quote(glance) + ` &&
Number(a.effect.getKeyframes()[0].opacity) === 0); })()`)
- th.wait(`!window.__b.querySelector(".dots")`) // faded out under the glance
+ th.wait(`!window.__b.querySelector(":scope > .think-line > .dots")`) // faded out under the glance
if got := th.eval(`(() => { const b = window.__b, p = [];
- if (b.querySelector(".dots")) p.push("the dots still show");
+ if (b.querySelector(":scope > .think-line > .dots")) p.push("the wordless dots still show");
if (!b.matches(".thinking") || !b.querySelector("canvas")) p.push("no longer thinking, with its spark");
if (document.querySelectorAll("#ask-panel .thinking").length !== 1) p.push(document.querySelectorAll("#ask-panel .thinking").length + " bubbles");
if (document.querySelector("#ask-panel .ask-status").textContent) p.push("the status line says " + document.querySelector("#ask-panel .ask-status").textContent);
@@ -529,6 +529,77 @@ func TestAskGlance(t *testing.T) {
th.wait(`[...document.querySelectorAll("#ask-panel .msg.coordinator")].some(m => m.dataset.id && m.textContent === "All done.") && !document.querySelector("#ask-panel .thinking")`)
}
+// glanceJS reports how the watched bubble's glance (window.__b) does not
+// read as a status: secondary ink (want), italic, one line, the three dots
+// after its words, hidden from assistive tech, shimmering or (still) not.
+func glanceJS(want string, still bool) string {
+ return `(() => { const b = window.__b, say = b.querySelector(":scope > .think-line > .say"), p = [];
+ if (!say) return "no status words";
+ const w = say.querySelector(":scope > .words"), d = [...say.querySelectorAll(":scope > .dots > i")], s = getComputedStyle(say);
+ if (s.fontStyle !== "italic" || getComputedStyle(w).fontStyle !== "italic") p.push("upright");
+ if (s.color !== ` + strconv.Quote(want) + `) p.push("ink " + s.color);
+ if (getComputedStyle(w).whiteSpace !== "nowrap") p.push("wraps");
+ if (d.length !== 3) p.push(d.length + " dots after the words");
+ if (say.querySelector(".dots")?.getAttribute("aria-hidden") !== "true") p.push("the dots are read out");
+ if (d.length && d[0].getBoundingClientRect().left < w.getBoundingClientRect().right - 0.5) p.push("the dots are not after the words");
+ for (const i of d) {
+ const c = getComputedStyle(i), moving = c.animationName === "think-dot, think-hue";
+ if (moving === ` + strconv.FormatBool(still) + `) p.push("a dot: " + c.animationName);
+ if (i.getBoundingClientRect().width < 4 || !(Number(c.opacity) > 0.3)) p.push("a dot hardly shows");
+ }
+ return p.join("; "); })()`
+}
+
+// A glance (or an activity line) is a status, not a reply: secondary ink,
+// italic, AA on the bubble in dark and light, and the soft dots after it,
+// still shimmering, so the Assistant is plainly still working (holding
+// still with reduced motion). The reply that takes its place is upright,
+// in full ink, with no dots.
+func TestAskGlanceReadsAsStatus(t *testing.T) {
+ rig, f := askBase(t)
+ th := thinking{t, rig, f}
+ const glance, reply = "Yo, Paul.", "Here is what I found."
+ for _, c := range []struct {
+ scheme string
+ still bool
+ haze, frost string
+ }{
+ {"dark", false, "rgb(221, 227, 240)", "rgb(238, 242, 248)"},
+ {"light", false, "rgb(74, 82, 117)", "rgb(30, 36, 64)"},
+ {"dark", true, "rgb(221, 227, 240)", "rgb(238, 242, 248)"},
+ } {
+ when := c.scheme + map[bool]string{false: "", true: ", reduced motion"}[c.still]
+ drive(t, rig, chromedp.EmulateViewport(1280, 800), reducedMotion(c.scheme, c.still))
+ openPanel(t, rig)
+ id := th.send("Anything new?")
+ drive(t, rig, chromedp.Evaluate[chromedp.Void](watchJS(glance)))
+ f.Glance(id, glance)
+ th.wait(`window.__g > 0 && !window.__b.querySelector(":scope > .think-line > .dots") && !window.__b.getAnimations({ subtree: true }).some(a => !(a instanceof CSSAnimation))`)
+ if got := th.eval(glanceJS(c.haze, c.still)); got != "" {
+ t.Errorf("%s, the glance: %s", when, got)
+ }
+ if !c.still {
+ worst, need, where := textContrast(t, rig, thinkingSel+" .say")
+ t.Logf("%s: the glance's contrast %.2f (%q)", when, worst, where)
+ if worst < need {
+ t.Errorf("%s: the glance %q has contrast %.2f, needs %.1f", when, where, worst, need)
+ }
+ rig.Screen("#ask-panel", "the glance as a status, "+when)
+ }
+ f.Answer(id, reply, false)
+ th.wait(`window.__b.dataset.id && window.__b.textContent === ` + strconv.Quote(reply) + ` && !document.querySelector("#ask-panel .think-line") && !window.__b.getAnimations({ subtree: true }).length`)
+ if got := th.eval(`(() => { const b = window.__b, p = [];
+ for (const e of [b, ...b.querySelectorAll("*")]) { const s = getComputedStyle(e);
+ if (s.fontStyle !== "normal") p.push(e.tagName + " " + s.fontStyle);
+ if (s.color !== ` + strconv.Quote(c.frost) + `) p.push(e.tagName + " ink " + s.color); }
+ if (b.querySelector(".dots, .say")) p.push("status left in it: " + b.innerHTML);
+ return p.join("; "); })()`); got != "" {
+ t.Errorf("%s, the reply: %s", when, got)
+ }
+ }
+ drive(t, rig, reducedMotion("dark", false))
+}
+
// steadyJS watches the thinking bubble frame by frame from now on, until
// window.__stop: in window.__steady, every frame's problem (no words or
// dots in view, the line's text empty once words have come, the bubble's
@@ -579,9 +650,11 @@ func TestAskThinkingHoldsSteady(t *testing.T) {
}
th.wait(`document.querySelector(` + strconv.Quote(thinkingSel+" .think-line") + `).textContent === ` + strconv.Quote(line))
if line == long {
- if got := th.eval(`(() => { const l = document.querySelector(` + strconv.Quote(thinkingSel+" .think-line") + `), c = l.lastElementChild, s = getComputedStyle(c);
- return [c.getClientRects().length, Math.round(c.getBoundingClientRect().height) <= Math.ceil(parseFloat(s.lineHeight)), c.scrollWidth > c.clientWidth, s.textOverflow].join(" "); })()`); got != "1 true true ellipsis" {
- t.Errorf("the 120-character line: boxes, one line high, clipped, overflow %s; want 1 true true ellipsis", got)
+ if got := th.eval(`(() => { const l = document.querySelector(` + strconv.Quote(thinkingSel+" .think-line") + `), c = l.lastElementChild.querySelector(".words"), s = getComputedStyle(c);
+ const d = l.lastElementChild.querySelector(".dots").getBoundingClientRect(), b = l.parentElement.getBoundingClientRect();
+ return [c.getClientRects().length, Math.round(c.getBoundingClientRect().height) <= Math.ceil(parseFloat(s.lineHeight)), c.scrollWidth > c.clientWidth, s.textOverflow,
+ d.width > 0 && d.left >= c.getBoundingClientRect().right - 0.5 && d.right <= b.right].join(" "); })()`); got != "1 true true ellipsis true" {
+ t.Errorf("the 120-character line: boxes, one line high, clipped, overflow, dots in view after it %s; want 1 true true ellipsis true", got)
}
}
drive(t, rig, chromedp.Sleep(400*time.Millisecond))
diff --git a/internal/look/static/app.css b/internal/look/static/app.css
index c4524bd..02c2f0a 100644
--- a/internal/look/static/app.css
+++ b/internal/look/static/app.css
@@ -707,7 +707,6 @@ aside.ask-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; widt
instead; with reduced motion the edge just glows, still. */
@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.msg.thinking, .msg.answered { position: relative; }
-.msg.thinking { color: var(--haze); }
.msg .spark { position: absolute; left: -8px; top: -8px; width: calc(100% + 16px); height: calc(100% + 16px); pointer-events: none; }
.msg.thinking::before, .msg.answered::before { content: ""; position: absolute; inset: 0; padding: 1.5px; border-radius: inherit; pointer-events: none; opacity: 0;
transition: opacity .35s ease;
@@ -734,7 +733,13 @@ aside.ask-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; widt
keeps the bubble's width from shrinking until the reply.) */
.msg > .think-line:has(> .say, > .dots) { display: grid; }
.think-line > .say, .think-line > .dots { grid-area: 1 / 1; min-width: 0; }
-.think-line > .say { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+/* Equipo's words there are a status, not a reply: secondary ink, italic,
+ and the dots after them, still shimmering, so the bubble plainly still
+ works. The reply comes upright, in full ink. The words end in the
+ ellipsis; the dots always show. */
+.think-line > .say { display: flex; align-items: center; color: var(--haze); font-style: italic; }
+.say > .words { min-width: 0; padding-right: .15em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.say > .dots { flex: none; margin-left: 5px; }
.ask-page { display: flex; flex-direction: column; padding: 22px 0 0; }
.ask-page .crumb { padding: 0 24px; }
.ask-page .ask-head { padding-left: 24px; }
diff --git a/internal/look/static/ask.js b/internal/look/static/ask.js
index 4b82651..59a7dc7 100644
--- a/internal/look/static/ask.js
+++ b/internal/look/static/ask.js
@@ -936,10 +936,9 @@ function start(root) {
const li = document.createElement("li");
li.className = "msg coordinator thinking";
li.dataset.thinking = id;
- const dots = span("dots");
+ const dots = threeDots();
dots.setAttribute("role", "img");
dots.setAttribute("aria-label", "Thinking…");
- dots.append(document.createElement("i"), document.createElement("i"), document.createElement("i"));
li.append(span("think-line"));
li.firstChild.append(dots);
thread.append(li);
@@ -947,12 +946,19 @@ function start(root) {
spark.start(li);
scroll();
}
+ function threeDots() {
+ const dots = span("dots");
+ dots.append(document.createElement("i"), document.createElement("i"), document.createElement("i"));
+ return dots;
+ }
// say puts words in bubble b in place of what it says (its dots, or
// other words), crossfading in place: both sit in the line's one grid
// cell, the new fading in as the old fade out, so the bubble is never
// blank, and it keeps its height (one line, an ellipsis if need be) and
// only grows wider (widen). shown runs as the words come into view.
- // Instant with reduced motion, or out of sight.
+ // Instant with reduced motion, or out of sight. The words are a status,
+ // not a reply: set apart in the CSS, and followed by the dots, still
+ // shimmering (hidden from assistive tech, which reads the words).
const FADE = 260;
function say(b, words, shown) {
const line = b.querySelector(":scope > .think-line");
@@ -960,7 +966,9 @@ function start(root) {
if (!line || (now && now.matches(".say") && now.textContent === words)) return;
for (const c of [...line.children]) if (c !== now) c.remove(); // already on their way out
const w0 = b.getBoundingClientRect().width;
- const next = span("say", words);
+ const next = span("say"), dots = threeDots();
+ dots.setAttribute("aria-hidden", "true");
+ next.append(span("words", words), dots);
line.append(next);
const instant = still.matches || !line.getClientRects().length;
widen(b, w0, instant);