Repository navigation
fix(chat): open a chip's bubble off the words it reports on, and name the recovery - #14036
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify in attachment-02's trade-off — a below bubble deliberately covers the message's own next line — reads acceptably at real message densities. [DESIGN-REVIEWED] 463cfaf |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the red-on-base claims: each new test names its failure on the merged head; I cannot run them, a human can. Not justified as shipped
What this change shipsInventory (6 items) — 3 justifiedIntent: FIX — make a chip's copy-outcome bubble land readably (off the words being read, on-screen) and make the failure notice name a next step.
[FIRST-PRINCIPLES-REVIEWED] 463cfaf |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS "The copy failed. Ctrl/Cmd+click copies…" restates the gesture that just failed as the recovery, and "full session ID" read as jargon to the blind reader. Watch
Suggestions
[UX-REVIEWED] 463cfaf |
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
3d2e0f1 to
e835c85
Compare
e835c85 to
b3eee0e
Compare
b3eee0e to
922bc91
Compare
|
|
d4e9fb9 to
473a078
Compare
473a078 to
1d2691e
Compare
… the recovery
A copy chip's bubble opened above its first line fragment, so for any chip
past its message's first line it covered the sentence the reader was in.
The bubble now opens above only from the message's first line and below
from any lower one (`useInstantTip({ placement: 'flow' })`, decided from the
first text line of the `[data-tip-flow]` container -- the hook's own
attribute, which the markdown renderer sets on its per-message root beside
the lightbox's `data-image-scope`; the hook binds to the OUTERMOST marked
ancestor, since the sanitizer keeps `data-*` on raw HTML and a message's own
`<div data-tip-flow>` must not capture a chip's first line or floor), and a
bubble below stays inside the box the reader sees -- the container, or the
nearer edge of an ancestor that clips it: one that would cross the message's
bottom edge -- and land on the timestamp and action row under it -- opens
above instead, as does one that would run off the bottom of the viewport.
viewport. A new outcome or the end of a hold re-anchors an open bubble, so
the clamp measured for the narrow hint never survives into the wider failure
notice, nor the reverse. The four failure notices share one family: the copy
chip's names the next step ("Couldn't copy -- select the text to copy it
manually"); the session, path and broken-image chips' name what failed to
copy ("Couldn't copy the full session ID for <the chip's label>" / "the path
<its tail>" / "the image path"), because their value is not the text they
show; the session and path chips, whose plain click opens or switches, lead
with the failure and then name the gesture -- "The copy failed. Ctrl/Cmd+click
copies the full session ID for <label>." -- so the verdict comes first, the
gesture reads as what the chip does rather than as an instruction, and a reader
who did not press it is not taught that a plain click copies. The gesture is `ctrlKey || metaKey`, so every string
about it says "Ctrl/Cmd+click", the two chips' "Ctrl/Cmd+click to copy"
tooltip included. Four catalog keys across the 13 locales, one tooltip value
changed in place. The renderer's root tag is laid out one attribute per line
(the accessible-interactive-elements rule greps added lines for a div carrying
its handler) and the comment above `streamClass` says so instead of claiming
the tag is byte-identical to base. The copy, cue and session-chip tests advance
the confirmation by the exported `COPIED_FLASH_MS`.
Fixes #14034
1d2691e to
463cfaf
Compare
|
|
|
|
|
|
|
Problem / Motivation
#13599 moved every inline chip's copy outcome into a shared
InstantTipbubble that opens 8px above the chip's first line fragment. Its round-4 review read the frames and found three things the merged head still does: for any chip past its message's first line the bubble lands on the sentence the reader is in the middle of; a chip near the right viewport edge keeps the clamp measured for the narrowClick to copyhint when the widerCopy failednotice replaces it, so the notice can be clipped off-screen; andCopy failedsays what happened but not what to do about it ("no idea why it failed or what I should do about it"). A fourth item is hygiene:COPIED_FLASH_MSwas exported "so tests advance exactly this" and no test imported it.Why it matters
The bubble is now the only place a copy's outcome is reported, so where it lands and whether it stays on-screen decide whether the report is readable at all. A failure notice with no next step leaves the user with a clipboard that did not change and nothing to do about it.
What changed (motivation → approach → change)
website/src/components/InstantTip.tsx:useInstantTipacceptsplacement: 'flow'. The bubble opensaboveonly when the anchor sits on the FIRST line of its flow container (read from layout), andbelowfrom any lower line — under the chip's box — so it never covers the words leading up to the chip. The container is a[data-tip-flow]element — the hook's own attribute, set by the markdown renderer on its per-message root (the element the lightbox marksdata-image-scope); a test pins one marked root per message, none nested. The hook binds to the OUTERMOST marked ancestor, so a message's own raw-HTML<div data-tip-flow>(the sanitizer keepsdata-*) captures nothing. The bubble is fitted after every newtip: a flow anchor'sbelowbubble must stay inside the viewport AND the box the reader sees (the tip'sfloor: the container's bottom, or the nearer edge of an ancestor that clips it, since a portal bubble escapes the clip); one that would cross either — onto the timestamp and action row under a message — goes above instead (itsflip); the explicitbelowis clamped. Every content change is a newtip, so the wide notice's clamp never survives into the narrow hint.website/src/components/MarkdownRenderer.tsx: the per-message root carriesdata-tip-flowbesidedata-image-scope(element, class list and click delegation unchanged; the tag laid out one attribute per line, the comment above it saying why); the copy chip and the title-cued chips (session, path, broken image) open their bubbles withplacement: 'flow'.CopyFailedNoticetakes its wording from the chip; the four notices form one family, "Couldn’t copy …". The copy chip's clipboard text IS the span the reader sees, so its notice names the recovery:Couldn’t copy — select the text to copy it manually. The title-cued chips copy something their label need not show — the session chip the key behind a nickname, the broken-image chip the path behind its alt — so "select the text" would copy the wrong thing; each names what failed to copy: the session chip the full session ID for its visible label, the path chip the path's tail (a clamped bubble still names its chip), the broken-image chip its object (Couldn’t copy the image path). The session and path chips copy on Ctrl/Cmd+click and open or switch on a plain click, so their notices lead with the failure and then name that gesture —The copy failed. Ctrl/Cmd+click copies the full session ID for chat-42….,The copy failed. Ctrl/Cmd+click copies the path vitest.config.mts.— a verdict first, never an instruction. The gesture isctrlKey || metaKey, so the copy saysCtrl/Cmd+clickeverywhere, the chips' tooltip included.copy_failedstays for the table copy. Four keys land in all 13website/src/i18n/localescatalogs, each locale's register; the tooltip value changes in place.Tests: the copy, cue and session-chip tests advance the confirmation by the exported
COPIED_FLASH_MS, not a literal1500.Not here: a pointer arrow on the bubble and the session chip's in-flow check moving into it (#13608); any change to the chips' rest-state look.
Backwards compatibility
Compatible: every click does what it did. Visual: a chip past its message's first line opens its bubble below itself instead of above, unless the bubble would leave the message's box (or the pane), in which case it opens above as before; the four failure notices share one family — the copy chip's
Couldn’t copy — select the text to copy it manually, the session chip'sThe copy failed. Ctrl/Cmd+click copies the full session ID for <its label>., the path chip'sThe copy failed. Ctrl/Cmd+click copies the path <its tail>., the broken-image chip'sCouldn’t copy the image path. The per-message root gains adata-tip-flowattribute (no class, role or handler change).useInstantTip'sabove(default) andbelowplacements are unchanged for their consumers;flowis opt-in. Four catalog keys added, none removed; thectrl_click_to_copytooltip readsCtrl/Cmd+click to copyin every locale.Tests
website/src/test/InstantTip.test.tsx: a held outcome wider than the hint it replaces re-clamps against the right viewport edge (anchor at 900 in a 1024 viewport: the 100px hint sits at 900, the 300px outcome moves to 716 — red on the merged head:expected 1200 to be less than or equal to 1016), and when the hold ends with focus still on the anchor the hint is measured afresh and returns to 900 (red:expected 716 to be 900); an explicitbelowbubble that would run off the bottom (anchor bottom 380, bubble 30px, viewport 400) is clamped to 362 (red:expected 388 to be 362);placement: 'flow'opens above from an anchor on its container's first line (first-line rect 100..118, anchor top 102 → 94/100, translate class,data-placement="above") and below from a lower one (a wrapped anchor's box bottom 214 + 8 at its left 20 → 222/20, no translate,data-placement="below"), goes above after all — at its first fragment, 338/600 — when below does not fit under a lower-line anchor (red:data-placement="below"received), and falls back to above without a flow container or without layout to read the first line from. Abelowbubble stays inside its container's box: with the container at 100..240 and a 30px bubble, an anchor at 144 opens below (172), a wrapped anchor whose box ends at 240 takes its flip and opens above its first fragment (188/240) — red on4f14857e08:data-placement="below". Inside a host that clips the container (overflow-y: hidden, clip bottom 200, container running on to 400) the clip edge is the floor: an anchor at 130 opens below (158), one at 170 flips above (162) — red ona8c23a6bf6:data-placement="below". Adata-tip-flowelement NESTED inside the container — the shape raw HTML produces — does not capture the measurement: an anchor on the nested element's first line (150..168) but a lower line of the message (first line 100..118) opens below at 180, past the nested box's bottom (200) and inside the message's (300) — red ond4e9fb9bbc:data-placement="above".website/src/test/MarkdownRenderer.inlineCodeCue.test.tsx: the flow container is the renderer's per-message root, which carries exactly twodata-attributes —data-image-scopeand the newdata-tip-flow; a chip on its first line opens above (top 94) and a chip in a later paragraph opens below its box (178/60) — red on the merged head:data-placement="above"received; red on922bc91914: no[data-tip-flow]element.data-tip-flowmarks the per-message root only, never a nested subtree: two messages holding a quoted paragraph with a chip and an image (local paths —main's feat(security): redaction that explains itself (RFC prototype C+A) #12684 defers a remote image to a click, so it renders no<img>), a nested list, a table, a fenced block and a link — one marked root each, no marked ancestor or descendant, every chip and image resolving to its own message's root, anddata-image-scopeon the same two elements and nowhere else. The path chip's refused Ctrl/Cmd+click reads exactlyThe copy failed. Ctrl/Cmd+click copies the path a.md.— the failure first, then the gesture and the path's tail — and never "select the text" (red onb3eee0e856:Copy failed; on4f14857e08:Couldn’t copy the path; onc663deaa71: no gesture; on473a078fa1: a trailing(Ctrl+click); on1d2691e5ac: the gesture-first sentence); its tooltip advertisesCtrl/Cmd+click to copy(red on473a078fa1:Ctrl+click to copy). A message's own raw-HTML<div data-tip-flow>reaches the DOM (two marked elements: the root and, inside it, the div) and does not capture the chip it wraps: with the div laid out 150..200 the chip's below bubble (180..210) would cross ITS bottom and flip above, but the container is the root (100..240), so it opens below (180/60) — red ond4e9fb9bbc:data-placement="above". A chip past the first line opens below while the bubble fits inside the root's box (root 100..240, bubble 30px: a chip at 152 opens at 180), and one whose bubble would cross the root's bottom opens above instead (a chip at 212: top 204,data-placement="above"; red on4f14857e08:data-placement="below").website/src/test/MarkdownRenderer.sessionChip.test.tsx: a SHORT slot name's refused Ctrl/Cmd+click copies the full key and its notice leads with the failure, then names the gesture and the full session ID for the chip's visible label — exactlyThe copy failed. Ctrl/Cmd+click copies the full session ID for chat-24.— never "select the text", which would have the reader copy the nickname (red on922bc91914:Couldn’t copy the session key; on36d6d59fc2:Couldn’t copy the key for chat-24; onc663deaa71: no gesture; on473a078fa1: a trailing(Ctrl+click); on1d2691e5ac: the gesture-first sentence); the notice sits in the bubble and clears with the flash. The full-key chip's refusals readThe copy failed. Ctrl/Cmd+click copies the full session ID for chat-24-1784661951.; its tooltip advertisesCtrl/Cmd+click to copy(red on473a078fa1:Ctrl+click to copy).website/src/test/streamingRevealIdleSettle.test.tsx: the root's class list is composed one term per state — exactlygroup ft-anim-smooth ft-streamingwhile a smooth stream runs,group ft-anim-smooth ft-streaming ft-idleonce it settles,groupalone withoutsmooth. Pinned because this change lays the root tag out one attribute per line and rewrites the comment abovestreamClass(its old reason, a tag left byte-identical to base, is gone). The expression itself ismain's: splittingft-idleinto a term of its own was tried and dropped, because a bare' ft-streaming'term tripsshadcn/no-unknown-classes— no stylesheet selects that class, amainquestion outside this change. The pin is green on473a078fa1too.website/src/test/MarkdownRenderer.brokenImage.test.tsx: the alt-labelled chip's refused click reads exactlyCouldn’t copy the image path— it copies the path behind its alt, which is not the text on the page (red onb3eee0e856:Copy failed).website/src/test/MarkdownRenderer.inlineCodeCopy.test.tsx: the refused-write notice's text is exactlyCouldn’t copy — select the text to copy it manually(red on the merged head:Copy failed; red on922bc91914:Copy failed — select the text to copy it manually), and every later refusal in that file reads the same family.COPIED_FLASH_MS(andCOPY_FAILED_FLASH_MS) in place of their hardcoded1500s.Run: nine InstantTip / chip / consumer test files (
InstantTip,MarkdownRenderer.test,.brokenImage,.inlineCodeCue,.sessionChip,.inlineCodeCopy,.inlineCodeBlock,.inlineCodeInLink,streamingRevealIdleSettle) andnpx vitest run src/i18n(the catalog gates incl. French U+202F and the hi/bn register, at changed-value strictness againstmain) pass by name;tsc --noEmitand eslint on the changed files pass; the production build, the analyze build,check-bundle-size.mjs(715 chunks within budget) andcheck-chunk-cycles.mjs(no cycles) pass on the same tree; no added line carries a<div … onClick(the root's tag is laid out one attribute per line; its element and handler aremain's; the comment above the tag states that reason). The single commit sits directly on currentmain. Rebased onto main47594b8390(#12684; past #14268, the platformdirs heal); the inherited Windows reds from #14249 clear. #12684 and this change both append keys at the end of the catalogs'markdownRenderersection: resolved keep-both,main's block first, every catalog re-parsed as JSON. No local GPT or Opus lane read this head: the server review lanes are its first model read; the mechanical gate above is the pre-push evidence.Await Fast GateandCoverage Gatewere red on the previous head because the Fast Gate run sat queued past the 725 s wait (runner starvation, #12800), not from this change.Manual verification
website/scripts/capture-inline-code-chip-cue.mjs(the harness #13599 added, extended here) drove the built SPA in Chromium and asserted 117 facts from the live DOM before each frame; the ones this change adds: a first-line chip's hover bubble opens above at its first fragment (data-placement="above", top = fragment top − 8); with both clipboard layers stubbed to refuse, the notice readsCouldn’t copy — select the text to copy it manuallyverbatim and its bubble stays inside the viewport (right 881 ≤ 1172); the refused notice on a between-line chip opens below it and stays off the message's timestamp and action row; the wrapped copy chip'sCopied!bubble opens BELOW it (data-placement="below", top = box bottom + 8 at the box's left) with the sentence's opening line ending above the bubble and the bubble inside the viewport; a copy chip on a message's LAST line opens its bubble above, at its first fragment, off the footer row; with the composer hidden and the viewport shortened so a between-line chip is the pane's last visible line, its bubble flips above (theflippath, live); the session chip's title advertisesCtrl/Cmd+click to copy; the session, path and broken-image chips' refused copies open the notice naming what failed to copy — exactlyThe copy failed. Ctrl/Cmd+click copies the full session ID for chat-42-1758000000.,The copy failed. Ctrl/Cmd+click copies the path vitest.config.mts.,Couldn’t copy the image path— at the pressed chip on the side the flow rule picks — the session chip's above (first line), the broken-image chip's above (the message's last line), the path chip's above and pulled left by the viewport clamp (its fragment starts at 1041 in a 1180 viewport; the bubble ends at 1172 and still overlaps the chip), every one of them off the footer row. On the merged head the same script read the wrapped chip's bubble above its first fragment, over the preceding sentence, and every notice asCopy failed.Screenshots / video
Hovering a first-line chip: the bubble opens above, off the message.
A refused write on a chip past the first line, with lines of its own message under it: the notice names the recovery and the bubble opens under the chip, over the message's own next line — never on the timestamp and action row.
A wrapped copy chip past the first line:
Copied!opens below where the chip ends.A copy chip on a message's last line: below it the bubble would sit on the timestamp and action row, so it opens above, off that row.
A between-line chip as the pane's last visible line (composer hidden, viewport shortened): below would run off the pane, so the bubble takes its flip and opens above.
The title-cued chips' refused copies name what failed to copy, on the side the flow rule picks; the path chip's bubble is pulled left by the viewport clamp and still overlaps the chip.
Related Issues
Fixes #14034
The round-4 review items on #13599's merged head. Related: #13513, #13608.
Pattern harvest
Rule candidate: review-prompt
Pattern: a tooltip or popover positioned relative to an inline anchor in running text without checking which lines of the surrounding prose it covers, or measured once against the viewport and never re-measured when its content changes width
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)