Skip to content

Keep slash command names visible when an argument hint is long - #7565

Merged
ymichael merged 1 commit into
get-bb:mainfrom
dillonzq:bb/issue-7564-thr_p98pup9q6m
Nov 16, 2026
Merged

ymichael merged 1 commit into
get-bb:mainfrom
dillonzq:bb/issue-7564-thr_p98pup9q6m

Conversation

@dillonzq

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

In a command row of the composer's / menu (CommandResults in plugins/composer/src/mentions/MentionMenu.tsx), the argument hint was shrink-0 with no truncation. The description is [flex-shrink:9999] and gives way first. After it reached zero width, the name was the only item left that could shrink. A hint wider than the row (Claude Code's built-in code-review hint is ~575 px) therefore collapsed the name to 0 px and pushed the row past the menu, so the menu scrolled sideways on phone-width screens. See #7564.

What changed

  • plugins/composer/src/mentions/MentionMenu.tsx: a command row's description and argument hint now sit in one trailing group, flex: 1 1 0 with min-w-0. The group gets only the space the name leaves, so the name truncates only when it alone is wider than the row. Inside the group, the description uses flex: 1 1 0 with max-width: max-content. It takes only the space the hint leaves and still ends at its text, so the hint stays right after it. The hint is now truncate. Space gives way in this order: description, then argument hint, then name. Mention rows are unchanged.
  • plugins/composer/src/mentions/Mentions.stories.tsx: the long-command fixture gains a code-review row with the long hint from the issue. A new Command widths story renders it at 360, 480 and 760 px. WidthSample now takes a menu state so mention and command samples can share it.
  • apps/app/.ladle/tests/command-menu-widths.mjs: a dev-browser geometry check for that story, alongside the existing .ladle/tests scripts. It asserts that the menu never scrolls sideways, every visible part stays inside its row, and the name is never hidden. It also asserts that the name truncates only after the description and hint have zero width, and that the hint truncates only after the description has zero width. Truncation is detected with sub-pixel precision, comparing the text range width with the box width, because scrollWidth rounds to whole pixels.

Deviation from the issue's suggested fix: I did not use a larger shrink factor on the hint or a max-w-[50%] cap. Flex shrinking is proportional to shrink factor × basis, so with weights alone the hint still loses a fraction of a pixel while the description is visible. That fraction is enough to replace the hint's tail with an ellipsis. At 760 px, code-review rendered as … [--max-findings <n>|… next to a visible description. Zero flex bases give a strict order instead. Because the name now has priority, the long-name story row at 360 px shows a truncated name with no hint. Before, it showed a name truncated to ~100 px next to the full hint.

How you verified

  • Ran apps/app/.ladle/tests/command-menu-widths.mjs with dev-browser (headless Chrome) against the plugins/Composer/Mentions → Command widths story in preview mode. To run it, start pnpm exec ladle serve in apps/app, open ?story=plugins--composer--mentions--command-widths&mode=preview on page main, then run dev-browser run apps/app/.ladle/tests/command-menu-widths.mjs.
    • Original code fails with 358px: menu scrolls horizontally. The code-review name measures 0 px, the hint 575 px, and the row overflows.
    • With only shrink weights changed (the intermediate approach), it fails with 478px moss-skills:moss-formulas-variables: argument hint truncates before the description.
    • This change passes at 360, 480 and 760 px. code-review keeps its full 71 px name at every width. At 760 px the full 575 px hint shows and only the description truncates.
  • Compared screenshots of the Overview story: short command rows (command sections) render as before, with the hint right after the description.
  • pnpm exec turbo run typecheck lint test --filter=bb-plugin-bb--composer: 9/9 tasks passed (96 tests).
  • oxfmt --check and oxlint on the changed files.

Fixes #7564

AGENT GENERATED

🤖 Generated with Claude Code

The argument hint in a command menu row was shrink-0 and never truncated,
so a hint wider than the row collapsed the command name to zero width and
made the menu scroll sideways. Description and hint now share a trailing
group that takes only the space the name leaves, and inside it the
description takes only the space the hint leaves, so they give way in the
order description, hint, name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit dafe34e into get-bb:main Nov 16, 2026
44 checks passed
smsunarto added a commit to smsunarto/bb-plugins that referenced this pull request Nov 18, 2026
…BBP-14) (#184)

* fix(t3-composer): size the empty composer editor to one line

* fix(t3-composer): inset the Project and Environment search field from the sheet's top

Monokai now draws bb's picker search row as a bordered field. T3 Composer's
older rule zeroed its top margin, so the field touched the sheet's edge. Inset
it 4px like the rows, size the field rather than the input so it no longer
overflows the border, and give phones a 44px field with 16px text.

* feat(t3-composer): open the desktop composer two lines tall

The empty editor's minimum grows from one 20px line to two (48px). Touch
screens keep their one-line 32px minimum.

* fix(t3-composer): stop text typed after a mention pill from gluing onto it

Port of get-bb/bb#6581 (38c939c85). Serialization adds a space between a
pill and an adjacent word or pill, so the agent sees /review Also, not
/reviewAlso.

* fix(t3-composer): close a multiword @ query once it settles with no matches

Port of get-bb/bb#7002 (631a62619). Typing on after an unmatched @query
("@see you later") no longer keeps an empty menu over the prose. Shortening
the query back reopens it, shown again only once something matches.
typeahead.test.tsx covers it in the mounted composer, since upstream's
tests live in bb's app.

* fix(t3-composer): cap the editor by the visible shell height

Port of get-bb/bb#7061 (9519ec685). On iOS dvh ignores the software
keyboard, so a long draft pushed the composer under the header. The caps
now read BB's --bb-shell-height (bb 0.49 defines it), including the
plugin's own !important thread-composer rule in app.css, which would
otherwise keep the old 50dvh cap.

* fix(t3-composer): keep slash command names visible when an argument hint is long

Port of get-bb/bb#7565 (dafe34edc). A long argument hint, such as Claude
Code's code-review, collapsed the command name and pushed the / menu
sideways on phones. Description, then hint, now give way before the name.
Uses gap-1, not upstream's gap-1.5, to stay on the plugin's 4px grid; the
Storybook story is skipped since Storybook was removed here.

* feat(t3-composer): run a built-in / command when its row is clicked

Port of the composer part of get-bb/bb#7480 (1983b0dfb): a click on a
built-in command now sends it, as Enter already did. The plugin's own
/handoff stays excluded, so a draft before it is not sent with the
handoff. #7480's host-side /handoff is not in bb 0.49 and the plugin
keeps its own; its pill-delete cancel was already ported (a9aada1).

* perf(t3-composer): share one resize observer and read before writing

Port of get-bb/bb#7635 (2d04779a1). The composer's height tracker, editor
cap and typeahead max-height observe through one shared ResizeObserver
that runs every read before any write. lib/shared-resize-observer.ts is
vendored from packages/shared-ui with its tests, less the case for
useMeasuredValue, which this plugin does not have. bb 0.49's plugin
runtime exposes the full react-dom namespace, so its flushSync resolves.

* docs(t3-composer): record the upstream sync base and held changes

The fork base d4fa9cb is not on get-bb/bb's main; its content matches
21d5db72c. The plugin is now synced through 2d04779a1. Also corrects the
stated BB and SDK requirement to match package.json.

* fix(t3-composer): clear the last 4 frozen lint errors

Bare oxlint on the plugin now exits 0. Each is a reasoned suppression with
precedent elsewhere in the repo: attachment videos carry no captions, the
form delegates its children's keys and presses, the test fake mirrors
BB's role-based picker DOM, and an object URL is created and revoked as
one effect pair. Removes their lint-baseline entries.
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.

Composer / menu: a long argument hint hides the command name and makes the menu scroll sideways on mobile

2 participants