fix(admin): clamp tooltips into the viewport

The portal kept cards out of table overflow but nothing kept them on screen:
centred on a fixed-width card, any trigger near an edge lost text -- reported
on Sessions' right-aligned Generate button. The shared Tooltip now measures the
card, clamps it to the viewport, flips below when there is no room above, and
keeps the arrow aimed at the trigger. No more CSS centreing transform, JS owns
the coordinates.

New tooltip-containment.spec.ts (4 tests) asserts the measured rectangle, no
document widening and arrow alignment at wide/narrow/short viewports; verified
it catches the bug by reverting the fix (3 of 4 fail). Full serial e2e: 211
passed, 0 failed.
This commit is contained in:
Lago committed 2026-10-19 21:19:30 +02:00
1 parent 5e13c8ec1d
commit 184449adb6
5 files changed
+250 -8

No files matched your search

+23
View File
@@ -616,3 +616,26 @@ both apps + sidecar) and the verdict fix (`d14e1c2`, admin + sidecar only).
- **Not run against prod**: the browser suites. They provision and delete real
contacts/registrations (`checkin-points.spec.ts` deletes by email), which on this
database would collide with imported pretix data. Local only, as before.
## Post-deploy: tooltip ran off the viewport (user-reported)
The Sessions "Generate AI Feedback Summary" tooltip rendered half off the right
edge. The card is portal-rendered (so tables cannot clip it) but was centred on
its trigger with a fixed 250px width and no viewport clamp — every trigger near a
screen edge overflowed; Sessions' right-aligned toolbar just made it obvious.
Fix in the shared `Tooltip`: measure the laid-out card, clamp `left`/`top` to the
viewport, flip below when there is no room above, and re-aim the arrow at the
trigger after any sideways shift. The card no longer carries a centring
transform — JS owns the final coordinates. All 6 call sites benefit.
- `e2e/tests/tooltip-containment.spec.ts` (4 tests) asserts the measured card
rectangle is inside the viewport, the document never widens, and the arrow
still points at the control — at wide, narrow (700px) and short (260px)
viewports, plus the Registrations "no points" tooltip. **Validated by
temporarily reverting the fix: 3 of 4 fail on the old code.**
- Mock gotcha recorded in the spec: the auth path reads the contact with
`maybeSingle()`, so the `?email=eq.…` route must answer an **object** —
answering with an array silently drops the app to the login screen, which
looks exactly like a broken tooltip.
- Full serial e2e: **211 passed, 0 failed.**