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. Co-authored-by: Stephan Charles <[email protected]> Co-authored-by: Amelia Hernandez <[email protected]> Co-authored-by: Markus Franz <[email protected]> Co-authored-by: Sabrina Hota <[email protected]> Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
1 parent
8be6680a67
commit
23af4f3930
5 files changed
+250
-8
No files matched your search
@@ -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
|
||||
|
||||
@@ -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.**
|
||||
Reference in new issue
Block a user