Skip to content

Widget: draw the resting capsule chat circle at 58px - #499

Merged
neuromechanist merged 7 commits into
developfrom
feature/issue-490-capsule-size
Sep 24, 2026
Merged

neuromechanist merged 7 commits into
developfrom
feature/issue-490-capsule-size

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Closes #490

With the panel closed, a capsule community's chat circle is drawn 25% larger (58px, its icon about 26px) so the launcher is easy to see; it settles to today's 46px as the panel opens, and grows back when it closes.

How

  • Drawn larger, not laid out larger: scale: 1.2609 and translate: -6px -6px under .osa-chat-widget:not(.chat-open) .osa-launcher-capsule .osa-chat-button. The button's box stays 46px, so the indicator (positioned from offsetLeft/offsetTop), the pill, the notebook and HPC circles and the panel's right: calc(20px + 46px + 7px + 12px) are identical open or closed, and nothing reflows while it shrinks.
  • The translate puts the circle's bottom-right corner where the 46px box's is, 20px from the window's edges, as the bubble's. The translate is the growth past the box on each side, 23px x (58/46 - 1) = 6px, so the corner holds still through the whole 280ms transition, because scale and translate share one duration and curve (the pill's).
  • Hovered at rest, the circle grows 5% more (scale: 1.3239; translate: -7.45px -7.45px; transform: none) in place of the shared transform: scale(1.05), so its corner holds on hover too. The open state's hover is unchanged.
  • The collapsed label ("Explore NEMAR") moves to right: 88px; bottom: 29px: the same 10px gap and vertical center the bubble's label has beside its 56px. It is hidden while the panel is open.
  • prefers-reduced-motion: reduce: the capsule's chat button was already in the reduced-motion block, so the size changes at once; the comment there now says so, and a test holds it.
  • A browser without the scale and translate properties draws today's 46px. The pop-out has no launcher, so it is unaffected; a bubble community's selectors never match.

Done when

  • The collapsed and open sizes are covered by the widget's happy-dom tests: frontend/test-widget-notebook-tab.js (closed: scale 1.2609 and translate -6px -6px on a 46px box, 58/46 and 6px checked numerically, scale and translate on one timing, the other circles unscaled; open: no scale, the panel where it was; closed again; the bubble unscaled; under a reduced-motion device, 1ms transitions), frontend/test-widget-first-paint.js (drawn at 58px from the first frame of a remembered load), frontend/test-widget-capsule.js (the label's place for the capsule, and the bubble's unchanged 86px/28px).
  • Checked on test.nemar.org in Chrome and Safari: not yet, since test.nemar.org embeds the develop widget, which deploys once this merges. Checked locally in headless Chrome 153 instead (below); Safari still to do on test.nemar.org after merge.
  • docs/community-widget.md "Launcher" section updated (the resting size, how it is drawn, the transition, reduced motion, the Chrome check); CHANGELOG entry under [Unreleased].

Tests

  • frontend/browser-harness/first-paint-check.mjs --serve (in CI) now, on both devices: hovers the resting circle with a real pointer (to 60.9px, corner held in every frame); presses it through Input.dispatchMouseEvent 3px inside the 58px circle and 9px outside its 46px box, where the browser's hit test must find the button and the panel must open; and opens and closes the panel at 1440px and at 390px wide (the row layout), sampling the chat circle on every animation frame from just before the click: 58px to 46px and back through 7 frames in between, its corner 20px from both edges in all ~44 frames, the panel where it was (85px from the right edge, 20px at 390px) and the indicator exactly behind the circle. 102 checks pass (42 before).
  • Locally, in Chrome at 1440x900: the resting circle is 58.0px at 20px from both edges, the label 10px to its left with centers 0.25px apart; open, the circles are 46px and the "SOON" badge sits where it did.
  • Every Bun suite in tests.yml passes (widget suites: tools 312, capsule 133, color scheme 126, notebook tab 168, first paint 82, dataset questions 60, pop-out 132); uv run pytest --ignore=tests/test_integration -m "not network" 2924 passed, 21 skipped; uv run ruff check . clean; popout-check.mjs --serve 49 passed; color-scheme-check.mjs --serve passed.

Mutation checks

Each applied alone, the named test run, then restored and the restore confirmed by comparing git diff --stat before and after:

Mutation Caught by
no translate at rest notebook-tab: "closed: the chat circle is drawn at 58px"; Chrome: corner at 14px
no scale at rest notebook-tab (3 checks), first-paint
the rule not scoped to :not(.chat-open) notebook-tab: "open: back to its 46px box"
the rule not scoped to .osa-launcher-capsule notebook-tab: the bubble is scaled
translate on another duration and curve notebook-tab: "share one duration and curve"; Chrome: corner drifts up to 1.3px
no transition on scale and translate Chrome: "0 frames in between, not a snap"
the label at its old 76px/24px capsule: "10px left of the resting circle"
the chat button dropped from the reduced-motion block notebook-tab (2 checks)
overflow: hidden on the capsule (clips the overflow) Chrome: the hit test finds the page, the real press opens nothing
no resting hover rule Chrome: the hovered corner drifts 1.3px; notebook-tab: the rule is missing
the hover translate left at -6px notebook-tab: "with the translate that holds the corner still"

The capsule's chat circle is drawn 25% larger while the panel is
closed (scale plus a 6px translate, so its box stays 46px and its
bottom-right corner stays put) and settles to 46px as the panel
opens. The collapsed label moves beside the larger circle. Reduced
motion changes the size at once. Bubble communities are unchanged.

Tested: bun frontend/test-widget-notebook-tab.js (164 passed),
test-widget-capsule.js (133), test-widget-first-paint.js (82);
seven mutations each caught and restored.
first-paint-check.mjs opens and closes NEMAR's panel and samples the
chat circle on every frame: 58px to 46px and back through frames in
between, its corner 20px from both edges in every frame, and the
panel and indicator where they were.

Tested: bun frontend/browser-harness/first-paint-check.mjs --serve
(62 passed); removing the translate, moving it to another curve,
and dropping the transition each fail it.
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-issue-490-capsule-si-demo.osc.earth
Branch feature/issue-490-capsule-size
Commit b136cf4

This preview will be updated automatically when you push new commits.

Hovered at rest, the capsule's chat circle takes its 5% growth in
its scale and translate instead of the shared transform: scale(1.05)
around its center, so its bottom-right corner stays put, as it does
through open and close. Rewords the 6px comment.

Tested: bun frontend/test-widget-notebook-tab.js (168 passed); a
wrong hover translate fails it.
first-paint-check.mjs now hovers the resting circle with a real
pointer (corner held, 60.9px), presses it 3px inside the 58px circle
and 9px outside its 46px box through Input.dispatchMouseEvent (the
panel opens), and repeats the open and close sampling at 390px wide.

Tested: bun frontend/browser-harness/first-paint-check.mjs --serve
(102 passed); overflow: hidden on the capsule and dropping the hover
rule each fail it.
@neuromechanist

Copy link
Copy Markdown
Member Author

Review response

  1. (Important) Hit area. Fixed in c02de49. first-paint-check.mjs now presses the resting circle with a real pointer (Input.dispatchMouseEvent, mouseMoved/mousePressed/mouseReleased) 26px left of its center: 3px inside the 58px circle and 9px outside its 46px layout box (x 1365 against a box starting at 1374). It checks document.elementFromPoint there finds the chat button, and that the press opens the panel; a real press on the open 46px circle then closes it. Mutation: overflow: hidden on .osa-launcher-capsule fails it (the hit test finds the page, the press opens nothing); restored and confirmed by diff.
  2. (Suggestion) Hover corner. Pinned, in 0c6506f. I kept the translate rather than transform-origin: 100% 100%: an origin that holds only at rest would switch to the center the moment the panel opens and jump mid-transition, and one held always would change the open circle's hover, which grows around its center like the notebook circle beside it. Hovered at rest, the circle now takes its 5% growth in its own scale and translate (scale: 1.3239; translate: -7.45px -7.45px; transform: none, on the same 280ms curve), so the corner holds; the open state's hover is unchanged. Chrome now hovers it with a real pointer: 60.9px, corner at 20px in all ~31 frames, and back to 58px on leaving. Mutations: removing the rule fails Chrome (the corner drifts 1.3px) and the notebook-tab suite; a hover translate left at -6px fails the notebook-tab suite.
  3. (Suggestion) Docs sentence. Split in 03dce5a: "It is drawn larger rather than laid out larger, with CSS scale and translate, so its box stays 46px. Nothing else in the capsule depends on whether the panel is open: not the indicator, not the pill, and not the panel's place beside it." The next sentence says the corner holds while it resizes and while it is hovered at rest.

Also from a second review pass (Sonnet), both suggestions:

  • The resize was only sampled in Chrome at 1440px wide. The check now repeats the open and close sampling at 390px wide, where the capsule is a row and the panel opens above it (panel 20px from the right edge).
  • "exactly 6px" overstated the rounded constant (6.0007px at scale: 1.2609); the comment now says the translate is the growth past the box, 23px x (58/46 - 1) = 6px.

Reruns: bun frontend/test-widget-notebook-tab.js 168 passed (164 before), test-widget-capsule.js 133, test-widget-first-paint.js 82; bun frontend/browser-harness/first-paint-check.mjs --serve 102 passed (62 before). The PR body's test and mutation sections are updated.

@neuromechanist
neuromechanist merged commit b331eba into develop Sep 24, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-490-capsule-size branch September 24, 2026 22:19
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.

1 participant