The interactive-control hit-test only ran at <=480px. On OrangeCat /messages
the launcher stepped over the Cat FAB (a fixed element, correctly avoided) and
landed exactly on the composer's Send button: clicking Send opened the
feedback panel and no message went out, from Sep 6 until now.
- stepOffControls: pure, bounded, tested; runs at every viewport width.
- Re-run placement after client-side navigation (URL poll), since SPA route
changes emit neither load nor resize.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Shipped in #466, verified green by 38 assertions, and completely inert on
a real page. Found by probing the deployed bundle rather than trusting
the suite.
avoidOffsetY cloned its input with `{...own}`. At runtime `own` is a
DOMRect from getBoundingClientRect(), and DOMRect exposes left/top/right/
bottom as GETTERS ON THE PROTOTYPE, not own enumerable properties. So the
spread produced `{}`; every comparison became `undefined < number`, which
is false; and the function concluded, silently and without error, that
nothing was ever in the way. The launcher stayed at bottom:16 on top of
whatever it was covering.
Every existing assertion passed because their fixtures are object
literals, and those spread perfectly. The suite could not have caught
this — it was testing a shape the browser never produces.
Fixed by reading the four fields explicitly (toRect) at every boundary
rather than relying on the source object's shape: in avoidOffsetY, in the
loop's box arithmetic, and in probeCorner.
The regression test builds its fixture with Object.create over prototype
getters and NO own properties — the actual DOMRect shape. A class with
fields would not have reproduced it, since TypeScript compiles those to
own properties and the spread survives. Proven by mutation: restoring the
spread turns exactly that one assertion red.
Diagnosis path, since it was not obvious: reposition() WAS running (it
reset a vandalised inline style), probeCorner's filters all passed when
replicated by hand in the page, no exception was thrown, and boot served
autoAvoid:true. The only remaining suspect was the data crossing between
them.
Also: w-25 on the position preview was the only use of that utility in
the repo; w-24 is on the conventional scale.
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Every mainstream chat/support widget — Intercom, Crisp, Tawk, Drift, and
most in-house AI assistants — defaults to the bottom-right corner. So did
ours, with a z-index near the 32-bit maximum, so on any site running both
we won and hid THEIR control. Reported on kivvi; it is structural, not
specific to that site.
The only escape was `data-fc-bottom` on the script tag, which means
editing the customer's HTML: not one click, and impossible on a site we
do not deploy.
Three layers now, because none is sufficient alone:
1. AUTO-AVOID, any viewport. The launcher measures its corner and steps
up past foreign fixed/sticky elements, re-checking on resize and at
800ms/2.5s to catch chat scripts that boot late. Matching is by
rectangle, so it works against a vendor we have never heard of.
Replaces a dodge() that only ran at ≤480px and RESET to the base
offset above it — which is exactly why desktop collisions survived.
Full-width bars are skipped (stepping over a cookie banner just lands
on the next one) and a shift larger than MAX_AVOID_SHIFT is abandoned
rather than chasing the launcher off-screen.
2. REMOTE PLACEMENT. Corner + nudge + an auto-avoid switch live on the
token and are served by /api/widget-boot, so moving a launcher on a
live customer site is a dashboard action that lands within the boot
cache window. The snippet stays a pointer — the same design idea as
the pause switch. Placement rides along with the render verdict, so
there is no window where the launcher paints in one corner and jumps.
3. VISITOR ESCAPE HATCH. Long-press (touch) or right-click (pointer) on
the launcher offers move / hide / reset, kept in localStorage per
token. For the case the other two missed, decided by the one person it
is actually blocking. The operator's kill switch still outranks it.
Also fixes a real bug found while reading the ingest path: PAUSE DID NOT
PAUSE. The boot call stopped the widget rendering, but the token is
public and sits in the customer's page source, so a paused project kept
accepting POSTs from anyone holding a copy — and the operator, seeing no
widget on the site, had no reason to suspect it. Ingest now rejects a
non-active token.
Operator surface, per the two places it is actually needed:
• project page: a position picker with a live preview box, because
"bottom-left, 16, 16" is not something anyone can picture
• Control inbox: Pause/Resume directly on the widget row, so the list
that told you it was off is where you turn it back on
38 assertions cover the geometry, including that the widget's normalizer
and the server's agree — the logic exists twice because widget/ cannot
import from src/, and drift there would make the dashboard preview lie
about where the launcher lands. One of those assertions caught a real
defect: after clearing one obstacle the launcher landed exactly flush
against the next, so the avoid test now runs against a gap-inflated box.
Migration 0062 adds a nullable placement column; NULL means the default.
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>