Skip to content

#900 Session Chat: floating pill component - #908

Merged
ivanfenenko merged 3 commits into
mainfrom
feature/900-floating-pill-component
Oct 31, 2026
Merged

ivanfenenko merged 3 commits into
mainfrom
feature/900-floating-pill-component

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #899. Fixes #900

What

A shared Floating Pill design-system component on iOS (OpenCodeFloatingPill) and Android (OpenCodeFloatingPill). Every Session Chat pill will use it. Placing pills on screen and migrating the existing pills are left to #903.

  • Layouts: iconLabel, iconOnly (round; its label is spoken), counter (live counter with a spinner; waiting: true swaps the spinner for a pulsing amber dot in needs attention), and closable (label with a trailing ✕ that calls onClose).
  • States: live, ready, needsAttention (amber text and a thin amber ring), error, and done (green check in every layout).
  • Look: same height (36), padding, type (button / labelLarge), icon size and chrome as OpenCodeSideQuestionPill. iOS reuses openCodeFloatingPillChrome (Liquid Glass on iOS 26); Android uses the btw pill's raised surface, border and shadow.
  • API: variant-first and state-aware. It takes only a layout, a state and optional action/onClick and onClose, with no colour, type or radius overrides. Without an action the pill is a status, not a button.
  • Accessibility: the pill speaks "label, state", e.g. "3 subagents, In progress". Icon-only pills take a required label. The close button speaks "Dismiss ". With Reduce Motion (iOS) or Remove animations (Android), the spinner becomes a still arc and the dot stops pulsing.
  • Layout and state map to the drawn content through a pure function (OpenCodeFloatingPillStyle on iOS, floatingPill* functions on Android), so both platforms test the same rules.
  • Component Gallery: a "Floating Pill" entry (Controls) on both platforms shows every layout × state, plus the waiting-counter variant. Shared files only get a small additive change: one registry entry and one detail route per platform.

Checks

  • iOS: OpenCodeFloatingPillStyleTests, 6/6 passed (iPhone 17 simulator, iOS 26.5).
  • Android: OpenCodeFloatingPillTest, 6/6 passed; :app:assembleDebug OK; ktlintCheck reports nothing in the changed files.
  • gitleaks git --pre-commit --staged: no leaks.
  • Evidence (attached in a comment): the real Component Gallery on the iPhone 17 simulator and the Pixel 9a emulator, light and dark.

Risks / Follow-ups

  • I did not use the publish-ui-snapshots renderers for evidence:
    • iOS ImageRenderer can't draw the UIKit-backed ProgressView spinner, and it shows a placeholder instead.
    • Android :screenshot (Paparazzi) doesn't compile on main: OpenCodeBottomSheet uses OpenCodeSkeletonIllustrationTopic, and the icon tables use R, neither of which the module includes.
    • Instead, the screenshots come from the real gallery, shown through a temporary, uncommitted root swap.
  • The live spinner and the pulsing dot appear only as still frames. The Reduce Motion paths are covered by code review, not by a screenshot.
  • Android gives the pill no frosted glass, matching today's Android btw pill (a 95% raised surface).
  • Gallery icons are stand-ins (callSplit, arrowDownward) because the catalog has no branch or worktree icon yet. Session Chat: corner slots for floating pills #903 can add real ones.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Low Risk
Additive UI library and gallery-only integration; no production Session Chat or data-path changes in this diff.

Overview
Introduces a cross-platform Floating Pill design-system component (OpenCodeFloatingPill on Android Compose and iOS SwiftUI) meant to unify Session Chat overlay pills in a follow-up; this PR does not wire it into chat screens yet.

The API is layout + state driven: six layouts (icon+label, icon-only, live counter with optional waiting, closable with dismiss, plain label) and five states (live, ready, needs attention with amber ring, error, done with green check). Compact mode collapses to a round mark for keyboard-up layouts; optional tap and close handlers, with accessibility labels and live-region behavior for active counters. Layout/state → visuals and copy are encoded in testable pure helpers (floatingPill* on Android, OpenCodeFloatingPillStyle on iOS), with matching unit tests on both platforms.

Component Gallery gains a Controls entry and demo screen showing every layout × state plus compact variants. Navigation/registry changes on Android and iOS are limited to that new route.

Reviewed by Cursor Bugbot for commit f1ac52f. Bugbot is set up for automated code reviews on this repo. Configure here.

@ivanfenenko

ivanfenenko commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator Author

Floating Pill gallery: every layout × state

These come from the real Component Gallery, shown through a temporary local root swap that isn't in the PR. The iPhone 17 simulator runs iOS 26.5, so iOS shows Liquid Glass chrome. Android ran on the Pixel 9a emulator.

iOS light iOS dark Android light Android dark
Top: icon + label, icon only ios top light ios top dark android top light android top dark
Bottom: live counter, waiting counter, label + close ios bottom light ios bottom dark android bottom light android bottom dark

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review: 2 finding(s) that 2+ of 3 passes agreed on.

Outside the diff lines:

  • ios/OpenCode Mobile/OpenCode Mobile/Components/Chrome/OpenCodeFloatingPill.swift:252 low: Pulsing dot never starts pulsing if Reduce Motion is turned off while the pill is on screen
2 finding(s) from a single pass, not posted
  • AGENTS.md:195 medium: Evidence workflow now relies on gh file upload that the documented command never invokes (deepseek-v4.1-flash)
  • android/app/src/main/java/dev/opencode/mobile/ui/components/chrome/OpenCodeFloatingPill.kt:232 low: Closable pill's dismiss button has a 28x36dp touch target (deepseek-v4.1-flash)

opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.076

@ivanfenenko ivanfenenko left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review of the floating pill base (#900) against the issue and the follow-ups #903–#906.

What's good: both platforms have the same four layouts and five states. Layout and state map to the drawn content through matching pure functions, and both test suites check the same rules. The pill matches the btw pill's height (36), 14/8 padding, button/labelLarge type, 16 pt icons and chrome (iOS reuses openCodeFloatingPillChrome, so it gets Liquid Glass on iOS 26). Colours come from tokens only, with no raw colour, type or radius overrides. Reduce Motion / Remove animations is handled for both the spinner and the dot on both platforms. I checked the gallery screenshots in the evidence comment: nothing private shows (status bars show only the time), and the code and tests use placeholder data only.

Tests: I re-ran OpenCodeFloatingPillStyleTests (iOS) and OpenCodeFloatingPillTest (Android) locally. Both pass: 6/6 on iOS (iPhone 17 simulator, iOS 26.5) and 6/6 on Android (JVM unit tests).

Findings: two should-fix API gaps, each with an inline comment on both platforms. Both are additive to fix now, but harder to retrofit once #903 and #904 build on this:

  1. The spoken label can't be overridden for layouts that show a label. Branch, ↓ / "3 new", todos and the migrated btw pill would be read badly.
  2. There is no compact (mark-only) presentation for counter and closable pills, which #903's keyboard-up collapse needs. There is also no plain label-only layout for +N.

Plus two nits (updatesFrequently / live-region parity, Android ✕ hit target).

Housekeeping nit: the branch still includes the unmerged copy of "Attach PR evidence with gh instead of evidence branches", so the GitHub diff shows AGENTS.md, two skills and the deleted scripts/publish-evidence.sh. The content matches main (#896), so the merge is harmless. Rebasing onto main would leave only the pill files in the diff.

ivanfenenko and others added 2 commits October 31, 2026 13:36
One Session Chat pill on iOS and Android in four layouts (icon + label,
round icon only, live counter, label with close) and five states (live,
ready, needs attention, error, done), on the btw pill's height, type and
chrome. Gallery entries show every layout in every state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… pill

Review follow-ups on both platforms:
- Optional accessibilityLabel on the pill replaces the "label, state" speech
  and feeds the close button's label.
- compact keeps the leading mark (icon, spinner, dot or check; a state dot
  when there is none), hides text and close, and still speaks the label.
- New plain label layout for the "+N" button.
- Live and waiting counters announce updates on both platforms, tappable or not.
- Close touch target is 44 pt on iOS and 48 dp on Android at the same visual size.
- Android follows the Remove animations setting while the pill is shown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko
ivanfenenko force-pushed the feature/900-floating-pill-component branch from 2667e63 to f1ac52f Compare October 31, 2026 13:07
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

Floating Pill gallery after review fixes (f1ac52f): iOS

These come from the real Component Gallery on the iPhone 17 simulator (iOS 26.5), shown through a temporary local root swap that isn't in the PR. New: the Label only rows ("+3") and the Compact (keyboard up) grid, which shows every layout × state reduced to its mark. The ✕ looks the same as before; its hit area is now 44 pt.

Part Light Dark
Icon + label, icon only ios 01 light ios 01 dark
Icon only, live counter ios 02 light ios 02 dark
Waiting counter, label + close, label only ios 03 light ios 03 dark
Label only, compact grid ios 04 light ios 04 dark

Android screenshots will follow in a separate comment once the shared emulator is free.

@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f1ac52f. Configure here.

@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

Floating Pill gallery after review fixes (f1ac52f): Android

These come from the real Component Gallery on the Pixel 9a emulator, shown through a temporary local start-screen swap that isn't in the PR. They cover every layout × state, the new Label only rows ("+3") and the Compact (keyboard up) grid. The ✕ looks the same as before; its touch target is now 48 dp.

Part Light Dark
Icon + label, icon only, live counter android 01 light android 01 dark
Live counter, waiting counter android 02 light android 02 dark
Waiting counter, label + close android 03 light android 03 dark
Label + close, label only, compact grid android 04 light android 04 dark

The pulse started only in onAppear, so turning Reduce Motion off while the
pill stayed on screen left the dot still. Drive it from task(id:) instead so
it restarts (or stops) whenever the setting changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ivanfenenko
ivanfenenko merged commit 1c99e8c into main Oct 31, 2026
@ivanfenenko
ivanfenenko deleted the feature/900-floating-pill-component branch October 31, 2026 20:51
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.

Session Chat: floating pill component

1 participant