oficina / base Public

Save the dock in order, and give phones a /ask fallback

Wide-screen dock saves go one at a time and the last choice wins: what
is pressed meanwhile waits and only the latest is sent. A failed save
leaves the screen as chosen and is not taken as kept; a choice made
meanwhile, or the next press, is sent. On phones the Base button and
the field are links to /ask, so they work without scripts and keep no
wide-screen choice; the dock forms show only on wide screens. Home and
the header step back on a phone with transform alone. Opening the chat
shows its newest line at once. Tests: TestAskDockSavesInOrder,
TestAskDockSaveFails, TestAskPhoneUnchanged, TestHomeDocksAskOpenByDefault.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev dd8e5ecaeac93640a30695efe72f5ee9bfa31126 parent d270d60
7 files changed, +190 −21
  • internal/browsertest/ask_test.go +99 −2
  • internal/browsertest/mobile_test.go +28 −8
  • internal/browsertest/scroll_test.go +3 −2
  • internal/look/static/app.css +8 −3
  • internal/look/static/ask.js +45 −4
  • internal/web/templates/home.html +3 −2
  • internal/webtest/home_test.go +4 −0
diff --git a/internal/browsertest/ask_test.go b/internal/browsertest/ask_test.go
index 221b09d..acaacbf 100644
--- a/internal/browsertest/ask_test.go
+++ b/internal/browsertest/ask_test.go
@@ -87,12 +87,17 @@ func askBaseOn(t *testing.T, tweak func(*config.Config), view chromedp.Action[ch
const settledJS = `(() => { const d = document.querySelector("#ask-panel"), s = getComputedStyle(d);
return d.checkVisibility({ visibilityProperty: true }) && s.opacity === "1" && (s.transform === "none" || s.transform === "matrix(1, 0, 0, 1, 0, 0)"); })()`
+// readJS is true once the chat has read the conversation afresh (its
+// /ask/state answer is in), so what a test does next is not undone by it.
+const readJS = `performance.getEntriesByType("resource").some((e) => e.name.includes("/ask/state") && e.responseEnd > 0)`
+
// openPanel goes to Home, where on a wide screen Ask Base is docked open,
-// and waits for the chat to settle.
+// and waits for the chat to settle and read the conversation.
func openPanel(t *testing.T, rig *harness.Rig) {
t.Helper()
drive(t, rig, chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS(`#ask-panel textarea`)),
- chromedp.Poll[chromedp.Void](settledJS, chromedp.WithPollingTimeout(5*time.Second)))
+ chromedp.Poll[chromedp.Void](settledJS, chromedp.WithPollingTimeout(5*time.Second)),
+ chromedp.Poll[chromedp.Void](readJS, chromedp.WithPollingTimeout(5*time.Second)), chromedp.Sleep(100*time.Millisecond))
}
// slash presses "/" as a keyboard does: one keydown carrying the text, so
@@ -494,3 +499,95 @@ func TestAskComposerSendAndStop(t *testing.T) {
t.Errorf("messages sent: %d, want 2", n)
}
}
+
+// holdDock wraps the page's fetch so its /ask/dock posts follow plan, one
+// step per post: held for some milliseconds, then sent, or answered 500
+// without reaching Base. window.__dock lists the bodies posted.
+// It first waits for any post already on its way to settle.
+func holdDock(plan string) chromedp.Action[chromedp.Void] {
+ return chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
+ if _, err := chromedp.Poll[chromedp.Void](`!window.__out`, chromedp.WithPollingTimeout(3*time.Second))(ctx, target); err != nil {
+ return err
+ }
+ _, err := chromedp.Evaluate[chromedp.Void](`(() => {
+ window.__dock = []; window.__plan = `+plan+`; window.__out = 0;
+ const real = window.__fetch = window.__fetch || window.fetch;
+ window.fetch = async (url, opts) => {
+ if (!String(url).includes("/ask/dock")) return real(url, opts);
+ const p = window.__plan.shift() || {};
+ window.__dock.push(String(opts.body));
+ window.__out++;
+ try {
+ if (p.hold) await new Promise((r) => setTimeout(r, p.hold));
+ if (p.fail) return new Response("", { status: 500 });
+ return await real(url, opts);
+ } finally {
+ setTimeout(() => window.__out--);
+ }
+ };
+ })()`)(ctx, target)
+ return err
+ })
+}
+
+// toggles presses the X (0) and the Base button (1) in order, at once.
+func toggles(seq string) chromedp.Action[chromedp.Void] {
+ return chromedp.Evaluate[chromedp.Void](`(() => { for (const c of ` + strconv.Quote(seq) + `)
+ document.querySelector(c === "0" ? "#ask-panel form.dock-close" : "form.base-btn-form").requestSubmit(); })()`)
+}
+
+// The docked chat's saves go one at a time and the last choice wins: a
+// close held on its way, then an open, ends open on the server, and
+// presses made while one is on its way send only the latest.
+func TestAskDockSavesInOrder(t *testing.T) {
+ rig, _, b := askBaseWith(t, nil)
+ openPanel(t, rig)
+ drive(t, rig, holdDock(`[{ hold: 400 }]`), toggles("01"))
+ askClosed(t, b, false)
+ drive(t, rig, chromedp.Sleep(600*time.Millisecond))
+ askClosed(t, b, false)
+ if got := harness.Evaluate[string](rig, `window.__dock.join(" ") + " | " + document.documentElement.classList.contains("desk-closed")`); got != "open=0 open=1 | false" {
+ t.Errorf("close then open: posted and drawn %q, want open=0 open=1 | false", got)
+ }
+
+ // Close (held), open, close, open: two posts, the held close and the
+ // last choice, ending open.
+ drive(t, rig, holdDock(`[{ hold: 400 }]`), toggles("0101"),
+ chromedp.Poll[chromedp.Void](`window.__dock.length === 2`, chromedp.WithPollingTimeout(3*time.Second)), chromedp.Sleep(300*time.Millisecond))
+ askClosed(t, b, false)
+ if got := harness.Evaluate[string](rig, `window.__dock.join(" ")`); got != "open=0 open=1" {
+ t.Errorf("four presses posted %q, want the held close then the last choice", got)
+ }
+ drive(t, rig, chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS("#ask-panel textarea")))
+ if harness.Evaluate[bool](rig, `document.documentElement.classList.contains("desk-closed")`) {
+ t.Error("reloaded, the last choice (open) did not hold")
+ }
+}
+
+// A save that fails leaves the screen as the person chose it and is not
+// taken as kept: a choice made while it was on its way is sent once it
+// fails, and with none the next press saves.
+func TestAskDockSaveFails(t *testing.T) {
+ rig, _, b := askBaseWith(t, nil)
+ openPanel(t, rig)
+ // Close fails at once: the chat stays closed on screen, the server
+ // still holds open; the next press (open) saves.
+ drive(t, rig, holdDock(`[{ fail: true }]`), toggles("0"), chromedp.Sleep(300*time.Millisecond))
+ if !harness.Evaluate[bool](rig, `document.documentElement.classList.contains("desk-closed")`) {
+ t.Error("a failed save moved the chat back")
+ }
+ askClosed(t, b, false)
+ drive(t, rig, toggles("1"), chromedp.Poll[chromedp.Void](`window.__dock.length === 2`, chromedp.WithPollingTimeout(3*time.Second)))
+ askClosed(t, b, false)
+ drive(t, rig, toggles("0"))
+ askClosed(t, b, true)
+
+ // Open fails after a while; meanwhile close, then open again: once it
+ // fails, the last choice (open) is sent, though it is what failed.
+ drive(t, rig, holdDock(`[{ hold: 400, fail: true }]`), toggles("101"),
+ chromedp.Poll[chromedp.Void](`window.__dock.length === 2`, chromedp.WithPollingTimeout(3*time.Second)))
+ askClosed(t, b, false)
+ if got := harness.Evaluate[string](rig, `window.__dock.join(" ") + " | " + document.documentElement.classList.contains("desk-closed")`); got != "open=1 open=1 | false" {
+ t.Errorf("posted and drawn %q, want the failed open, then open again, drawn open", got)
+ }
+}
diff --git a/internal/browsertest/mobile_test.go b/internal/browsertest/mobile_test.go
index d6cbec1..c3272cd 100644
--- a/internal/browsertest/mobile_test.go
+++ b/internal/browsertest/mobile_test.go
@@ -85,8 +85,8 @@ func TestMobile(t *testing.T) {
// and the avatar, and the Ask field is under the greeting.
noOverflow(t, rig, "Home")
if got := harness.Evaluate[string](rig, `(() => {
- const bar = document.querySelector(".topbar"), icon = document.querySelector("button.base-btn"), field = document.querySelector(".ask-field");
- const shown = [...bar.querySelectorAll(":scope > *, :scope > form > *")].filter(e => getComputedStyle(e).display !== "none" && getComputedStyle(e).display !== "contents");
+ const bar = document.querySelector(".topbar"), icon = document.querySelector("a.base-btn"), field = document.querySelector("a.ask-field");
+ const shown = [...bar.querySelectorAll(":scope > *, :scope > form > *")].filter(e => e.checkVisibility());
const mids = shown.map(e => Math.round(e.getBoundingClientRect().top + e.getBoundingClientRect().height / 2));
const problems = [];
if (Math.max(...mids) - Math.min(...mids) > 2) problems.push("top bar wraps: " + mids.join(","));
@@ -114,7 +114,7 @@ func TestMobile(t *testing.T) {
layoutShot(t, rig, "phone-home-dark")
// The chat before connecting.
- drive(t, rig, chromedp.Click(chromedp.CSS(`button.base-btn`)),
+ drive(t, rig, chromedp.Click(chromedp.CSS(`a.base-btn`)),
chromedp.WaitVisible(chromedp.CSS(`#ask-panel [data-when="connect"] button`)),
// The sheet slides up; click once it has arrived.
chromedp.Poll[chromedp.Void](`document.querySelector("#ask-panel").getBoundingClientRect().top === 0`, chromedp.WithPollingTimeout(3*time.Second)))
@@ -189,7 +189,7 @@ func TestMobile(t *testing.T) {
// Focus goes back to the Base button, which opened it.
drive(t, rig, chromedp.Poll[chromedp.Void](`document.activeElement.className === "base-btn"`, chromedp.WithPollingTimeout(3*time.Second)))
// Reopened from the Base button, mid-conversation: the sheet slides up.
- drive(t, rig, chromedp.Click(chromedp.CSS(`button.base-btn`)), chromedp.Sleep(90*time.Millisecond))
+ drive(t, rig, chromedp.Click(chromedp.CSS(`a.base-btn`)), chromedp.Sleep(90*time.Millisecond))
if top := harness.Evaluate[float64](rig, `document.querySelector("#ask-panel").getBoundingClientRect().top`); top <= 1 {
t.Errorf("the sheet did not slide up: at %v moments after opening", top)
}
@@ -206,7 +206,7 @@ func TestMobile(t *testing.T) {
// With reduced motion there is no slide and no push-back: it just shows.
drive(t, rig, reducedMotion("dark", true), chromedp.Poll[chromedp.Void](phoneClosedJS, chromedp.WithPollingTimeout(3*time.Second)),
- chromedp.Click(chromedp.CSS(`button.base-btn`)), chromedp.Sleep(30*time.Millisecond))
+ chromedp.Click(chromedp.CSS(`a.base-btn`)), chromedp.Sleep(30*time.Millisecond))
if got := harness.Evaluate[string](rig, `(() => { const d = document.querySelector("#ask-panel").getBoundingClientRect();
const h = getComputedStyle(document.querySelector("main.home"));
return d.top + " " + h.transform + " " + h.filter + " " + h.opacity; })()`); got != "0 none none 1" {
@@ -243,7 +243,7 @@ func TestAskPhoneUnchanged(t *testing.T) {
t.Fatal(err)
}
when := fmt.Sprintf("ask_closed %v", closed)
- drive(t, rig, chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS(".ask-field")))
+ drive(t, rig, chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS("a.ask-field")))
if got := harness.Evaluate[string](rig, `(() => { const problems = [];
if (document.querySelector("#ask-panel").checkVisibility({ visibilityProperty: true })) problems.push("the chat shows");
if (!document.querySelector("#ask-panel").inert) problems.push("the chat is in reach");
@@ -253,7 +253,11 @@ func TestAskPhoneUnchanged(t *testing.T) {
return problems.join("; "); })()`); got != "" {
t.Errorf("%s, Home: %s", when, got)
}
- drive(t, rig, chromedp.Click(chromedp.CSS(".ask-field")), chromedp.Poll[chromedp.Void](whole, chromedp.WithPollingTimeout(3*time.Second)))
+ drive(t, rig, chromedp.Click(chromedp.CSS("a.ask-field")), chromedp.Poll[chromedp.Void](whole, chromedp.WithPollingTimeout(3*time.Second)))
+ // Only transform moves Home and the header back; the blur just applies.
+ if got := harness.Evaluate[string](rig, `getComputedStyle(document.querySelector("main.home")).transitionProperty + " " + getComputedStyle(document.querySelector(".topbar")).transitionProperty`); got != "transform transform" {
+ t.Errorf("%s: Home and the header transition %q, want transform alone", when, got)
+ }
if got := harness.Evaluate[string](rig, `[document.documentElement.classList.contains("phone-open"), document.activeElement.id, document.querySelector("main.home").inert, document.querySelector(".topbar").inert].join(" ")`); got != "true ask-text true true" {
t.Errorf("%s, opened by the field: %q, want phone-open, focus in the composer, Home and the header out of reach", when, got)
}
@@ -268,11 +272,27 @@ func TestAskPhoneUnchanged(t *testing.T) {
if got := harness.Evaluate[string](rig, `document.activeElement.className + " " + document.querySelector("main.home").inert`); got != "ask-field false" {
t.Errorf("%s, after X: %q, want focus on the field and Home in reach", when, got)
}
- drive(t, rig, chromedp.Click(chromedp.CSS(".ask-field")), chromedp.Poll[chromedp.Void](whole, chromedp.WithPollingTimeout(3*time.Second)),
+ drive(t, rig, chromedp.Click(chromedp.CSS("a.ask-field")), chromedp.Poll[chromedp.Void](whole, chromedp.WithPollingTimeout(3*time.Second)),
chromedp.KeyEvent("\u001b"), chromedp.Poll[chromedp.Void](phoneClosedJS, chromedp.WithPollingTimeout(3*time.Second)))
var got bool
if err := b.db.QueryRow(`SELECT ask_closed FROM members`).Scan(&got); err != nil || got != closed {
t.Errorf("%s: a phone's open and close were kept: ask_closed %v %v", when, got, err)
}
}
+
+ // Without scripts the field and the Base button go to /ask, and keep
+ // no wide-screen choice.
+ drive(t, rig, scriptsDisabled(true))
+ defer drive(t, rig, scriptsDisabled(false))
+ for _, opener := range []string{"a.ask-field", "a.base-btn"} {
+ drive(t, rig, chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS(opener)), chromedp.Click(chromedp.CSS(opener)),
+ chromedp.WaitVisible(chromedp.CSS(".ask-page .composer")))
+ if here := harness.Read(rig, chromedp.Location()); here != rig.Origin+"/ask" {
+ t.Errorf("scripts off, %s led to %s, want /ask", opener, here)
+ }
+ var got bool
+ if err := b.db.QueryRow(`SELECT ask_closed FROM members`).Scan(&got); err != nil || !got {
+ t.Errorf("scripts off, %s changed the wide-screen choice: ask_closed %v %v", opener, got, err)
+ }
+ }
}
diff --git a/internal/browsertest/scroll_test.go b/internal/browsertest/scroll_test.go
index e950183..5dbad46 100644
--- a/internal/browsertest/scroll_test.go
+++ b/internal/browsertest/scroll_test.go
@@ -53,8 +53,9 @@ func TestAskScrollFollowsNewest(t *testing.T) {
f.Say(fmt.Sprintf("Earlier line %d of a long conversation.", i))
}
if size.name == "phone" {
- drive(t, rig, chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS(`button.base-btn`)),
- chromedp.Click(chromedp.CSS(`button.base-btn`)), chromedp.WaitVisible(chromedp.CSS(`#ask-panel textarea`)))
+ drive(t, rig, chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS(`a.base-btn`)),
+ chromedp.Click(chromedp.CSS(`a.base-btn`)), chromedp.WaitVisible(chromedp.CSS(`#ask-panel textarea`)),
+ chromedp.Poll[chromedp.Void](readJS, chromedp.WithPollingTimeout(5*time.Second)), chromedp.Sleep(100*time.Millisecond))
} else {
openPanel(t, rig)
}
diff --git a/internal/look/static/app.css b/internal/look/static/app.css
index d07232f..5ad4cfd 100644
--- a/internal/look/static/app.css
+++ b/internal/look/static/app.css
@@ -441,6 +441,10 @@ a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.ask-slot { display: grid; grid-template-rows: 1fr; transition: opacity .3s .1s, transform .45s var(--ease), visibility 0s; }
.ask-slot > div { min-height: 0; overflow: hidden; margin: 0 -3px; }
.ask-field-form { padding: 0 3px 22px; }
+/* A wide screen's openers are forms (opening is kept); a phone's are links
+ to /ask, which work without scripts and keep nothing. */
+@media (min-width: 641px) { a.base-btn, a.ask-field { display: none; } }
+a.base-btn, a.ask-field { text-decoration: none; }
.ask-field { width: 100%; max-width: 520px; height: 48px; padding: 0 16px; border: 0; border-radius: 12px; display: flex; align-items: center; gap: 12px;
cursor: text; text-align: left; font: inherit; font-size: 15px; color: var(--haze); background: var(--well); box-shadow: inset 0 0 0 1px var(--well-edge);
transition: background .2s, box-shadow .2s; }
@@ -541,8 +545,8 @@ main { min-height: 100dvh; }
the home indicator. Home steps back behind it. */
@media (max-width: 640px) {
.shell { display: block; height: auto; min-height: 100dvh; overflow: visible; }
- .shell > .topbar { margin: 12px 12px 0; transform-origin: 50% 0; transition: transform .4s var(--ease), filter .4s; }
- .shell > .home { overflow: visible; padding: 0 12px calc(20px + env(safe-area-inset-bottom)); transform-origin: 50% 30%; transition: transform .4s var(--ease), filter .4s; }
+ .shell > .topbar { margin: 12px 12px 0; transform-origin: 50% 0; transition: transform .4s var(--ease); }
+ .shell > .home { overflow: visible; padding: 0 12px calc(20px + env(safe-area-inset-bottom)); transform-origin: 50% 30%; transition: transform .4s var(--ease); }
.topbar { gap: 10px; padding: 6px 6px 6px 12px; }
.team { display: none; }
.topbar .wordmark { margin-right: auto; }
@@ -551,7 +555,8 @@ main { min-height: 100dvh; }
glass panel, at iOS-like spacing. It scrolls with Home. */
.hello { margin-top: 26px; font-size: 30px; }
.lede { margin: 8px 0 14px; font-size: 15px; }
- .ask-field-form { padding-bottom: 14px; }
+ .base-btn-form, .ask-field-form { display: none; }
+ a.ask-field { width: auto; margin: 0 3px 14px; }
.ask-field { max-width: none; height: 44px; }
.ask-field kbd { display: none; }
.steps { gap: 6px; }
diff --git a/internal/look/static/ask.js b/internal/look/static/ask.js
index 009598f..8d2d776 100644
--- a/internal/look/static/ask.js
+++ b/internal/look/static/ask.js
@@ -440,8 +440,12 @@ function start(root) {
for (const o of openers) o.setAttribute("aria-expanded", String(open));
if (open !== shown) {
shown = open;
- if (open) load();
- else quiet();
+ if (open) {
+ // The conversation Home drew shows its newest line at once; the
+ // fresh read follows.
+ toBottom();
+ load();
+ } else quiet();
}
}
// The first thing to reach in the chat: the composer, or the visible
@@ -449,14 +453,43 @@ function start(root) {
function first() {
return chatting(root.dataset.state) ? field : root.querySelector("[data-when]:not([hidden]) .btn");
}
+ // A wide screen's choice is kept for the member's next visit; the screen
+ // has already moved. One save at a time, and the last choice wins: what
+ // is pressed while one is on its way waits, and only the latest is sent.
+ // A save that fails leaves the screen as the person chose it, quietly;
+ // nothing counts as kept, so a choice made meanwhile, or the next press,
+ // is sent.
+ let wanted = !html.classList.contains("desk-closed");
+ let kept = wanted; // what the server holds; null when a save failed
+ let presses = 0;
+ let saving = false;
+ function remember(open) {
+ wanted = open;
+ presses++;
+ save();
+ }
+ async function save() {
+ if (saving) return;
+ saving = true;
+ while (wanted !== kept) {
+ const open = wanted, at = presses;
+ let ok = false;
+ try {
+ const res = await fetch("/ask/dock", { method: "POST", headers: json, body: new URLSearchParams({ open: open ? "1" : "0" }) });
+ ok = res.ok;
+ } catch {}
+ kept = ok ? open : null;
+ if (!ok && presses === at) break;
+ }
+ saving = false;
+ }
function setOpen(open) {
if (phone.matches) {
html.classList.toggle("phone-open", open);
if (open) fit();
} else {
html.classList.toggle("desk-closed", !open);
- // Kept for the member's next visit; the class has already moved.
- fetch("/ask/dock", { method: "POST", headers: json, body: new URLSearchParams({ open: open ? "1" : "0" }) }).catch(() => {});
+ remember(open);
}
sync();
if (open) {
@@ -469,6 +502,14 @@ function start(root) {
const back = phone.matches && opener.checkVisibility() ? opener : [...openers].find((o) => o.checkVisibility({ visibilityProperty: true })) || openers[0];
if (back) back.focus({ preventScroll: true });
}
+ // On a phone the openers are links to /ask, which works without scripts.
+ for (const a of document.querySelectorAll("a[data-ask-open]")) {
+ a.addEventListener("click", (e) => {
+ e.preventDefault();
+ opener = a;
+ setOpen(true);
+ });
+ }
for (const form of document.querySelectorAll('form[action="/ask/dock"]')) {
form.addEventListener("submit", (e) => {
e.preventDefault();
diff --git a/internal/web/templates/home.html b/internal/web/templates/home.html
index 9f2f253..f380bf3 100644
--- a/internal/web/templates/home.html
+++ b/internal/web/templates/home.html
@@ -5,13 +5,14 @@
screen it shows only while the chat is closed. */}}<header class="topbar glass">
<div class="wordmark">base</div>
<div class="team">{{.Name}}</div>
-{{if .Ask}}<form class="base-btn-form" method="post" action="/ask/dock"><input type="hidden" name="open" value="1"><button class="base-btn" type="submit" data-ask-open aria-controls="ask-panel" aria-label="Ask Base" title="Ask Base"><span class="mark" aria-hidden="true"></span></button></form>
+{{/* A form on a wide screen, where opening is kept for the member; a link to /ask on a phone, which works without scripts. */}}{{if .Ask}}<form class="base-btn-form" method="post" action="/ask/dock"><input type="hidden" name="open" value="1"><button class="base-btn" type="submit" data-ask-open aria-controls="ask-panel" aria-label="Ask Base" title="Ask Base"><span class="mark" aria-hidden="true"></span></button></form>
+<a class="base-btn" href="/ask" data-ask-open aria-controls="ask-panel" aria-label="Ask Base" title="Ask Base"><span class="mark" aria-hidden="true"></span></a>
{{end}}<a class="me" href="/settings" aria-label="Settings">{{.Initials}}</a>
</header>
<main class="home" id="home">
<h2 class="hello">{{.Greeting}}</h2>
<p class="lede">{{.Lede}}</p>
-{{/* The Ask field under the greeting. It folds away while the chat is docked open. */}}{{if .Ask}}<div class="ask-slot"><div><form class="ask-field-form" method="post" action="/ask/dock"><input type="hidden" name="open" value="1"><button class="ask-field" type="submit" data-ask-open aria-controls="ask-panel"><span>Ask Base anything</span><kbd>/</kbd></button></form></div></div>
+{{/* The Ask field under the greeting. It folds away while the chat is docked open. */}}{{if .Ask}}<div class="ask-slot"><div><form class="ask-field-form" method="post" action="/ask/dock"><input type="hidden" name="open" value="1"><button class="ask-field" type="submit" data-ask-open aria-controls="ask-panel"><span>Ask Base anything</span><kbd>/</kbd></button></form><a class="ask-field" href="/ask" data-ask-open aria-controls="ask-panel"><span>Ask Base anything</span><kbd>/</kbd></a></div></div>
{{end}}<ul class="steps">
{{range .Steps}}<li class="glass{{if .Done}} done{{end}}"><span class="mark">{{if .Done}}✓{{end}}</span>{{.Label}}</li>
{{end}}</ul>
diff --git a/internal/webtest/home_test.go b/internal/webtest/home_test.go
index dfd3528..49379d0 100644
--- a/internal/webtest/home_test.go
+++ b/internal/webtest/home_test.go
@@ -264,6 +264,10 @@ func TestHomeDocksAskOpenByDefault(t *testing.T) {
`<form class="dock-close" method="post" action="/ask/dock"><input type="hidden" name="open" value="0">`,
`<form class="base-btn-form" method="post" action="/ask/dock"><input type="hidden" name="open" value="1">`,
`<form class="ask-field-form" method="post" action="/ask/dock"><input type="hidden" name="open" value="1">`,
+ // On a phone they are links to /ask, which works without scripts
+ // and keeps no wide-screen choice.
+ `<a class="base-btn" href="/ask" data-ask-open aria-controls="ask-panel" aria-label="Ask Base" title="Ask Base">`,
+ `<a class="ask-field" href="/ask" data-ask-open aria-controls="ask-panel"><span>Ask Base anything</span>`,
} {
if !strings.Contains(home.Body, want) {
t.Errorf("Home lacks %q:\n%s", want, home.Body)