Open a job's view in place when scripts are off
Without the popover the job view was positioned absolutely under the pill, so opening it covered the decision under the pill and the next job. It now stays in the conversation's flow and pushes what follows down; the pill rounds into a card to hold it. Only the enhanced popover is laid over the chat. Test: with scripts off, on a wide screen and a phone, the opened view covers neither the go-ahead under its pill nor the next job. The phone test now measures "under the pill" from the pill's row, which the open view sits inside.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+51
−4
internal/browsertest/cards_test.go+42 −0internal/browsertest/mobile_test.go+2 −2internal/look/static/app.css+7 −2
diff --git a/internal/browsertest/cards_test.go b/internal/browsertest/cards_test.go| index 6baeebd..f504f94 100644 |
| --- a/internal/browsertest/cards_test.go |
| +++ b/internal/browsertest/cards_test.go |
| @@ -630,3 +630,45 @@ func TestAskJobRedrawKeepsFocus(t *testing.T) { |
| t.Errorf("focused on a decision as its job arrived: %s", got) |
| } |
| } |
| + |
| +// Without scripts the job view opens in place, in the conversation's flow |
| +// (plan decision D13): opened, it pushes what follows down, the decision |
| +// under its pill and the next job, rather than covering them. |
| +func TestAskJobViewScriptsOffInPlace(t *testing.T) { |
| + rig, f := askBase(t) |
| + options := []equipo.Option{{Value: "go", Label: "Go ahead"}, {Value: "later", Label: "Not yet"}} |
| + try := equipo.Link{Label: "Try it", URL: "https://preview.example.test/"} |
| + id := f.AskJob("Building your website") |
| + f.SetJob(id, "ready", "Ready to try", "Have a look.", try) |
| + goAhead := f.AskOutcomeFor(id, "This is ready. Go ahead?", options, nil) |
| + next := f.AskJob("Fixing the login") |
| + drive(t, rig, scriptsDisabled(true)) |
| + defer drive(t, rig, scriptsDisabled(false)) |
| + for _, view := range []chromedp.Action[chromedp.Void]{chromedp.EmulateViewport(1280, 800), chromedp.EmulateViewport(390, 844, chromedp.EmulateMobile, chromedp.EmulateScale(3))} { |
| + page := `.ask-page li.job[data-job="` + id + `"]` |
| + drive(t, rig, view, chromedp.Navigate(rig.Origin+"/ask"), chromedp.WaitVisible(chromedp.CSS(page+" summary")), |
| + chromedp.Click(chromedp.CSS(page+" summary")), chromedp.Sleep(200*time.Millisecond)) |
| + if got := harness.Evaluate[string](rig, `(() => { const j = document.querySelector(`+strconv.Quote(page)+`), v = j.querySelector(".jobview"), p = []; |
| + if (!j.querySelector("details").open) p.push("closed"); |
| + if (!v.checkVisibility()) return p.concat("the view is not drawn").join("; "); |
| + const r = v.getBoundingClientRect(), s = j.querySelector("summary").getBoundingClientRect(); |
| + if (r.top < s.bottom || r.top - s.bottom > 12 || r.left < s.left - 0.5) p.push("not under the pill: " + JSON.stringify(r) + " pill " + JSON.stringify(s)); |
| + if (getComputedStyle(v).position !== "static") p.push("out of the flow: " + getComputedStyle(v).position); |
| + const clear = (sel, what) => { |
| + const el = document.querySelector(sel); |
| + if (!el) return p.push("no " + what); |
| + el.scrollIntoView({ block: "center" }); |
| + const o = el.getBoundingClientRect(), v2 = v.getBoundingClientRect(); |
| + if (o.top < v2.bottom && o.bottom > v2.top && o.left < v2.right && o.right > v2.left) p.push("covers " + what + ": " + JSON.stringify(o) + " view " + JSON.stringify(v2)); |
| + const at = document.elementFromPoint(o.left + o.width / 2, o.top + Math.min(o.height / 2, 20)); |
| + if (!el.contains(at)) p.push(what + " covered by " + (at && at.className)); |
| + }; |
| + clear(`+strconv.Quote(page+` ol.job-cards [data-card="`+goAhead+`"]`)+`, "the go-ahead"); |
| + clear(`+strconv.Quote(`.ask-page li.job[data-job="`+next+`"] .pill`)+`, "the next job"); |
| + if (document.documentElement.scrollWidth > document.documentElement.clientWidth) p.push("the page overflows"); |
| + return p.join("; "); })()`); got != "" { |
| + t.Errorf("scripts off, the job view opened: %s", got) |
| + } |
| + rig.Screen(".ask-page", "the job view opened in place, scripts off") |
| + } |
| +} |
diff --git a/internal/browsertest/mobile_test.go b/internal/browsertest/mobile_test.go| index 6f9e5c9..1c6d639 100644 |
| --- a/internal/browsertest/mobile_test.go |
| +++ b/internal/browsertest/mobile_test.go |
| @@ -364,7 +364,7 @@ func TestAskJobViewIsASheetOnPhones(t *testing.T) { |
| mobileShot(t, rig, "job-ready-phone-closed") |
| // Without scripts: /ask, and the pill opens its view in place, just |
| - // under it, with no Close and no scrim. |
| + // under its row, with no Close and no scrim. |
| drive(t, rig, scriptsDisabled(true)) |
| defer drive(t, rig, scriptsDisabled(false)) |
| page := `.ask-page li.job[data-job="` + id + `"]` |
| @@ -373,7 +373,7 @@ func TestAskJobViewIsASheetOnPhones(t *testing.T) { |
| if got := harness.Evaluate[string](rig, `(() => { const j = document.querySelector(`+strconv.Quote(page)+`), v = j.querySelector(".jobview"), p = []; |
| if (!j.querySelector("details").open) p.push("closed"); |
| if (!v.checkVisibility()) return p.concat("the view is not drawn").join("; "); |
| - const r = v.getBoundingClientRect(), pill = j.querySelector(".pill").getBoundingClientRect(); |
| + const r = v.getBoundingClientRect(), pill = j.querySelector("summary").getBoundingClientRect(); |
| if (r.top < pill.bottom || r.top - pill.bottom > 12 || r.left < pill.left - 0.5) p.push("not under the pill: " + JSON.stringify(r) + " pill " + JSON.stringify(pill)); |
| if (v.querySelector("[data-job-close]").checkVisibility()) p.push("Close shows"); |
| if (document.querySelector(".scrim")) p.push("a scrim"); |
diff --git a/internal/look/static/app.css b/internal/look/static/app.css| index f403657..135ae0e 100644 |
| --- a/internal/look/static/app.css |
| +++ b/internal/look/static/app.css |
| @@ -560,14 +560,19 @@ aside.ask-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; widt |
| @keyframes glow { from { opacity: .45; } } |
| /* The job view, opened from the pill: its title, the status, one sentence |
| more, when it started, and the link to the work. Without scripts it |
| - opens in place, just under the pill. With them (ask.js) it is a popover |
| + opens in place, just under the pill's row. With them (ask.js) it is a popover |
| in the top layer, anchored to the pill inside the chat, and on a phone a |
| sheet from the foot of the screen over the dimmed chat (the scrim). It |
| never sets display: the popover's own rules show and hide it. */ |
| .jobview { width: min(320px, calc(100vw - 32px)); padding: 10px 10px 12px 16px; border: 0; border-radius: 16px; color: var(--frost); background: var(--menu-base); |
| box-shadow: inset 0 0 0 1px var(--pill-edge), inset 0 1px 0 var(--menu-shine), 0 22px 48px -14px var(--menu-shadow); |
| font-size: 14px; line-height: 1.45; white-space: normal; text-align: left; } |
| -.job-toggle > .jobview:not([popover]) { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; } |
| +/* Without the popover (scripts off) the view opens in place, in the |
| + conversation's flow under the pill's row, pushing what follows down; |
| + the pill rounds into a card to hold it. Only the popover is laid over. */ |
| +.job-toggle > .jobview:not([popover]) { width: 320px; max-width: calc(100% - 12px); margin: 0 6px 6px; box-shadow: inset 0 0 0 1px var(--pill-edge); } |
| +.pill:has(> .job-toggle[open] > .jobview:not([popover])) { align-items: flex-start; border-radius: 22px; } |
| +.pill:has(> .job-toggle[open] > .jobview:not([popover])) > .pill-link { align-self: flex-start; min-height: 44px; } |
| .jobview[popover] { position: fixed; inset: auto; margin: 0; overflow: visible; animation: rise .18s var(--ease, cubic-bezier(.2,.8,.2,1)); } |
| .jobview header { display: flex; align-items: center; gap: 10px; } |
| .jobview header .state-mark { width: 26px; height: 26px; } |