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

+11
View File
@@ -198,6 +198,17 @@ portal so it is never clipped by the table's `overflow: hidden`. The shared badg
renderer lives in `components/BadgeRender.tsx`, used by both the editor and this
preview.
> **Portalling is not enough on its own.** It stops an `overflow` ancestor
> clipping the card, but nothing used to keep the card inside the **viewport**: it
> was centred on its trigger with a fixed 250px width, so any tooltip on a
> right-aligned control ran off the right edge — which is exactly what happened to
> Sessions' “Generate AI Feedback Summary”, whose card sat half off screen. The
> component now measures the laid-out card and clamps it to the viewport, flips it
> **below** a trigger that has no room above it, and re-aims the arrow so it still
> points at the control after the card has been pushed sideways. The card carries
> **no CSS transform**: `left`/`top` are its real viewport coordinates, because a
> centring transform makes the clamp arithmetic disagree with what is painted.
### Printing
The **Printing** view is the badge-print control center; the queue, stations and