Skip to content

fix(booking): cap the host face stack so it cannot spill into the calendar (#166) - #169

Merged
shockalotti merged 1 commit into
mainfrom
fix/host-face-overflow
Oct 26, 2026
Merged

shockalotti merged 1 commit into
mainfrom
fix/host-face-overflow

Conversation

@shockalotti

Copy link
Copy Markdown
Contributor

Closes #166.

The bug

The info panel drew one avatar per host with no cap. The arithmetic is unforgiving:

  • panel 240px, padding 1.5rem each side → 192px of content
  • face 56px, stack overlap 16px → 6 hosts = 256px

So 64px of avatars ran over the panel border into the calendar. I measured the uncapped build in a real browser before fixing: 6 faces, scrollWidth 256px against clientWidth 191px, last face 64px past the panel's content edge. Exactly the screenshot.

One correction to the report

You mentioned it previously capped at three. I checked the full git history (git log -S across book.html, book.go, embed.js for a slice/limit) and no cap ever existed. What was limited to three was the label — hostsLabel has always said "Wynne, Bob, Cara & 3 others" while the faces drew everyone. So the label and the faces disagreed, which is likely what you remembered. That's now consistent.

The fix

Draw at most three faces, matching the label. When more are hidden, show a +N chip in the fourth slot.

  • 3 faces + chip = 176px, inside 192px, 16px spare.
  • The chip sits above the last face (z-index) so its text is never clipped by the stack overlap.

Applied to both surfaces that draw faces, per the three-surface rule:

  • book.html — the server-rendered stack, and renderHosts which rebuilds it on slot pick.
  • embed.js — the shadow-DOM widget, which carries its own copy of the logic.
  • manage.html does not render host faces, only the shared CSS.

The chip itself is styled once in booking.css, which all surfaces load.

Verification

Real browser, fresh instance, event type with six required hosts:

faces stack width content edge overflow
before 6 256px 192px 64px
after (1280px) 3 + +3 176px 192px none
after (390px) 3 + +3 176px — none

Embed widget verified the same way in its shadow root: 4 elements, no overflow, label reads "Wynne, Bob, Cara & 3 others".

Tests:

  • TestCapHostFaces — the helper, including the exact-limit boundary.
  • TestBookPageCapsHostFacesAtThree — end-to-end through BookPage with six required hosts, asserting the rendered #host-faces block holds three faces plus a +3 chip. It fails against the uncapped code.

go test ./... green.

🤖 Generated with Claude Code

…endar (#166)

With several hosts on an event type the info panel drew every face. The panel
is 240px wide with 1.5rem padding (192px of content); faces are 56px and overlap
by 16px, so six hosts is 256px — 64px of avatars ran over the panel border into
the calendar column.

Draw at most three faces, matching hostsLabel, which already names only three
('Wynne, Bob, Cara & 3 others'). When more are hidden, render a '+N' chip in the
fourth slot; four circles is 176px and fits with room to spare.

Applied to both surfaces that draw faces: book.html (server-rendered plus the
renderHosts rewrite on slot pick) and embed.js (the shadow-DOM widget). The chip
is styled once in the shared booking.css, which both load. manage.html does not
render host faces.

Verified in a real browser at 1280px and 390px: 4 elements (3 faces + chip),
scrollWidth == clientWidth, no overflow. Against the uncapped build the same
page measured 6 faces and 64px of spill, matching the report.

Tests: a unit test for the cap helper, plus an end-to-end test through BookPage
with six required hosts asserting the rendered #host-faces block holds three
faces and a '+3' chip. The latter fails against the uncapped code.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one small widget-layout inconsistency.

Reviewed changes

  • Server-side cap — book.go adds maxHostFaces = 3, capHostFaces/hostsOverflow, and BookPage passes a capped Hosts plus the new HostsMore; HostsLabel/SoleHostName still use the full list.
  • book.html — server-rendered +N chip and the renderHosts slot-pick re-render both cap at three and append face-more.
  • embed.js — MAX_HOST_FACES = 3, infoPane() slices the stack and appends the chip.
  • booking.css — shared .face-more chip styling (56px, border-box, centered).
  • Tests — helper boundary cases plus an end-to-end BookPage render with six required hosts asserting three faces and +3.

Verified the full ./internal/handler/ suite passes, including both new tests. manage.html correctly stays out of scope since it renders a single avatar.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash | 𝕏

/* "+N" chip when the stack is capped (see maxHostFaces). Painted above the last
face and inset the same 16px, so its text is never clipped by the overlap. */
.host-faces .face-more {
width: 56px; height: 56px;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.face-more is fixed at 56px, but the embed widget's compact container query (@container (max-width:719px), embed.js:142) shrinks .info .avatar-img/.avatar-initials to 46px and has no .face-more override. At that breakpoint the chip renders 10px larger than the faces beside it and extends below their baseline, so the stack looks off on mobile embeds.

Technical details
# Compact embed: overflow chip does not inherit the shrunk face size

## Affected sites
- internal/handler/templates/booking.css:322-332 — `.face-more` hardcodes 56px.
- internal/handler/embed.js:142 — compact rule shrinks `.avatar-img`/`.avatar-initials` to 46px, but never `.face-more`.

## Required outcome
- At `@container (max-width:719px)`, the `+N` chip matches the 46x46 face size (and shrinks its font if needed) so the stack stays visually uniform.

## Suggested approach (optional)
- Append `.info .face-more{width:46px;height:46px;}` to the same compact rule at `embed.js:142` (the page templates keep 56px, so this belongs in the widget's layer, not the shared rule).

@shockalotti
shockalotti merged commit 86c983b into main Oct 26, 2026
10 checks passed
@shockalotti
shockalotti deleted the fix/host-face-overflow branch October 26, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Host icons spill over to the calendar

1 participant