Skip to content

fix(workbench): center desktop composer hero and polish no-connection prompt - #7551

Merged
M4n5ter merged 2 commits into
apache:mainfrom
ARE404:fix/composer-hero-alignment
Dec 3, 2026
Merged

M4n5ter merged 2 commits into
apache:mainfrom
ARE404:fix/composer-hero-alignment

Conversation

@ARE404

@ARE404 ARE404 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In #7515, the desktop new-conversation hero in plugins/agent/composer/ui/Composer.tsx was changed from flexDirection: 'row' to flexDirection: 'column', but flexWrap: 'wrap' remained enabled.

Because NSH resolves unset alignContent to flex-start on flex containers (third-party/nsh/crates/nsh-core/src/style.rs), the wrapped column shrank to the intrinsic width of the greeting text and aligned flush-left. As a result, HeroMark was centered only above the greeting text rather than over the composer column—and the misalignment stood out sharply in the no-connection state where the button and hint below were centered.

Changes

  • Desktop hero alignment (plugins/agent/composer/ui/Composer.tsx): keep flexWrap: 'wrap' only on terminal (horizontal layout) and use flexWrap: 'nowrap' on desktop so HeroMark and the greeting center cleanly over the composer (matching DESIGN.md).
  • No-connection prompt layout (plugins/agent/composer/ui/Composer.tsx):
    • Group the explanation text (maxWidth: 420) above the Add a model connection CTA in a single centered container with tighter spacing (gap: 12, compact 8).
    • Tighten the gap between the greeting and the prompt while keeping balanced bottom clearance above the composer.
    • Move the desktop completion-menu fade-out (opacity) onto the outer hero container so the no-connection prompt fades out alongside the greeting when the completion menu opens.
  • Tests (products/maka/workbench/src/composer_hero_tests.rs, products/maka/workbench/tests/fixtures/composer-hero.tsx, products/maka/workbench/app/QuickBar.tsx):
    • Add optional testID forwarding on HeroMark.
    • Add headless layout and interaction tests verifying desktop centering (with and without model connections), vertical stacking order (HeroMark → greeting → hint → CTA), hint width constraint, CTA click handling, and terminal horizontal hero layout preservation.

Verification

  • biome check on all modified TS/TSX files
  • tsc --noEmit on products/maka/bundle/tsconfig.json, packages/plugin-sdk/tsconfig.json, and generated ui_types workbench tsconfig (zero errors in touched/workbench files; only pre-existing unrelated ios-shell/app/ui/HostListNotices.tsx error on main)
  • node --test products/maka/workbench/tests/*.test.mjs (425/425 passed)
  • cargo fmt --all -- --check
  • cargo clippy --locked -p maka-workbench --lib --tests
  • cargo test --locked -p maka-workbench --lib composer_hero_tests (2/2 passed) and composer_notices_tests (4/4 passed)
  • node scripts/i18n/check.mjs
  • node scripts/asf-license-headers.mjs check

Screenshots

Captured in a native macOS Maka Preview window with an isolated Host root:

Before (misaligned hero & inverted prompt order) After (no model connection)
Before: flush-left hero and inverted no-connection prompt After: centered hero, constrained hint, and Add a model connection CTA

After (model configured)

After: HeroMark and greeting centered cleanly over the composer with a model configured

… prompt

In apache#7515, the desktop composer hero switched from flexDirection 'row' to 'column' while leaving flexWrap: 'wrap' in place. Because NSH resolves unset alignContent to flex-start on flex containers, the wrapped column shrank to the greeting width and aligned flush-left, leaving HeroMark centered only above the greeting text instead of the composer.

- Keep flexWrap: 'wrap' only for the terminal horizontal hero and use 'nowrap' on desktop so HeroMark and the greeting center over the composer.
- Group the no-connection hint (constrained to maxWidth: 420) above the 'Add a model connection' CTA in a centered block with tighter spacing to the greeting and unified completion-menu fade-out.
- Add headless layout and interaction tests covering both desktop (with and without model connections) and terminal hero layouts.
@github-actions github-actions Bot added the effort/M Under 500 readable lines label Dec 2, 2026

@M4n5ter M4n5ter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

English

Good catch on the flexWrap: 'wrap' + NSH alignContent: flex-start interaction from #7515, and the new composer_hero_tests.rs layout assertions directly guard the regression cleanly. One small issue to address before merging:

Invisible "Add a model connection" button remains clickable and focusable while the completion menu is open

Where: plugins/agent/composer/ui/Composer.tsx:584-598 (composer-hero container) and L679-L702 (Add a model connection button)

Previously, the completion-menu fade (opacity: completion.opened() === null ? 1 : 0) lived on the inner greeting <View>, which only contained non-interactive elements (HeroMark with pointerEvents: 'none' and <Text>). Moving opacity: 0 up to the outer composer-hero <View> now visually hides the interactive Add a model connection <Button> as well, without disabling hit-testing or focus:

  • In NSH (third-party/nsh/crates/nsh-platform-macos/src/view.rs:3581-3616, can_target / can_reach; same in nsh-platform-linux/src/input.rs:1468-1476), opacity: 0 does not prevent pointer hits or keyboard focus.
  • ComposerCompletion renders a left-aligned <Overlay> capped at 480 pt (plugins/agent/composer/ui/ComposerCompletion.tsx:997-1012) whose onPressOutside does not consume clicks on underlying views.
  • When a user with no model connections opens the completion menu (+ or /) and clicks in the seemingly blank space outside the popup where the centered button sits, the invisible button still fires props.settings and unexpectedly navigates to Settings.

Suggested fix: Disable pointer events on the desktop composer-hero container whenever the completion menu is open—e.g. style={[..., { pointerEvents: platform.idiom !== 'terminal' && completion.opened() !== null ? 'none' : 'auto' }]}. Since can_reach() checks ancestor can_target(), that single change blocks both accidental clicks and keyboard focus on the faded-out button.

简体中文

对 #7515 引入的 flexWrap: 'wrap' 与 NSH alignContent: flex-start 交互问题定位得很准,composer_hero_tests.rs 的布局断言也精准覆盖了这次回归。合入前有一个小问题建议顺手补上:

补全菜单打开、Hero 淡出为 opacity: 0 后,透明的「Add a model connection」按钮仍可点击和聚焦

位置: plugins/agent/composer/ui/Composer.tsx:584-598(composer-hero 外层容器)及 L679-L702(Add a model connection 按钮)

此前 opacity: completion.opened() === null ? 1 : 0 挂在内层问候语容器上,里面只有非交互元素(pointerEvents: 'none' 的 HeroMark 和 <Text>);本次上移到外层 composer-hero 后,把可交互的 Add a model connection <Button> 也一起藏成了透明,但没有关闭命中与聚焦:

  • 在 NSH 中(third-party/nsh/crates/nsh-platform-macos/src/view.rs:3581-3616 的 can_target / can_reach,以及 nsh-platform-linux/src/input.rs:1468-1476),opacity: 0 不会屏蔽点击命中和键盘聚焦。
  • ComposerCompletion 的 <Overlay> 左对齐且最宽 480 pt(plugins/agent/composer/ui/ComposerCompletion.tsx:997-1012),onPressOutside 也不会吞掉底层视图的点击。
  • 无模型连接的新用户通过 + 或 / 打开补全菜单后,点击菜单外看似空白的区域(若恰好落在居中透明按钮位置),不仅会关闭菜单,还会误触发 props.settings 直接跳进设置页。

建议修复: 在桌面端 composer-hero 的 style 上同步切换 pointerEvents(例如 style={[..., { pointerEvents: platform.idiom !== 'terminal' && completion.opened() !== null ? 'none' : 'auto' }]})。can_reach() 会检查祖先的 can_target(),这一行可以同时拦住误点击和键盘聚焦。

When the desktop completion menu opens and fades composer-hero to opacity 0, switch pointerEvents to 'none' so the invisible 'Add a model connection' CTA cannot be accidentally clicked or focused while hidden. Restore 'auto' once the completion menu closes, and cover both states in composer_hero_tests.
@ARE404

ARE404 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the catch @M4n5ter! Addressed in f6450e4:

  • Toggle pointerEvents: completion.opened() === null ? 'auto' : 'none' alongside opacity on the desktop composer-hero container in plugins/agent/composer/ui/Composer.tsx so the faded no-connection CTA cannot intercept pointer or focus hits while the completion menu is open.
  • Added headless assertions in products/maka/workbench/src/composer_hero_tests.rs verifying PointerEvents::None is mounted while completion is open, clicking the CTA position does not trigger settings, and hit-testing/clickability recover once the completion menu closes.

@M4n5ter M4n5ter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM — pointerEvents gating on the faded composer hero and headless regression coverage look clean.

@M4n5ter
M4n5ter merged commit 488c3d2 into apache:main Dec 3, 2026
1 check passed
@ARE404
ARE404 deleted the fix/composer-hero-alignment branch December 3, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants