Repository navigation
fix(workbench): center desktop composer hero and polish no-connection prompt - #7551
Conversation
… 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.
M4n5ter
left a comment
There was a problem hiding this comment.
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 innsh-platform-linux/src/input.rs:1468-1476),opacity: 0does not prevent pointer hits or keyboard focus. ComposerCompletionrenders a left-aligned<Overlay>capped at 480 pt (plugins/agent/composer/ui/ComposerCompletion.tsx:997-1012) whoseonPressOutsidedoes 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 firesprops.settingsand 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.
|
Thanks for the catch @M4n5ter! Addressed in f6450e4:
|
M4n5ter
left a comment
There was a problem hiding this comment.
LGTM — pointerEvents gating on the faded composer hero and headless regression coverage look clean.
Problem
In #7515, the desktop new-conversation hero in
plugins/agent/composer/ui/Composer.tsxwas changed fromflexDirection: 'row'toflexDirection: 'column', butflexWrap: 'wrap'remained enabled.Because NSH resolves unset
alignContenttoflex-starton 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,HeroMarkwas 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
plugins/agent/composer/ui/Composer.tsx): keepflexWrap: 'wrap'only onterminal(horizontal layout) and useflexWrap: 'nowrap'on desktop soHeroMarkand the greeting center cleanly over the composer (matchingDESIGN.md).plugins/agent/composer/ui/Composer.tsx):maxWidth: 420) above theAdd a model connectionCTA in a single centered container with tighter spacing (gap: 12, compact8).opacity) onto the outer hero container so the no-connection prompt fades out alongside the greeting when the completion menu opens.products/maka/workbench/src/composer_hero_tests.rs,products/maka/workbench/tests/fixtures/composer-hero.tsx,products/maka/workbench/app/QuickBar.tsx):testIDforwarding onHeroMark.HeroMark→ greeting → hint → CTA), hint width constraint, CTA click handling, and terminal horizontal hero layout preservation.Verification
biome checkon all modified TS/TSX filestsc --noEmitonproducts/maka/bundle/tsconfig.json,packages/plugin-sdk/tsconfig.json, and generatedui_typesworkbench tsconfig (zero errors in touched/workbench files; only pre-existing unrelatedios-shell/app/ui/HostListNotices.tsxerror onmain)node --test products/maka/workbench/tests/*.test.mjs(425/425 passed)cargo fmt --all -- --checkcargo clippy --locked -p maka-workbench --lib --testscargo test --locked -p maka-workbench --lib composer_hero_tests(2/2 passed) andcomposer_notices_tests(4/4 passed)node scripts/i18n/check.mjsnode scripts/asf-license-headers.mjs checkScreenshots
Captured in a native macOS
Maka Previewwindow with an isolated Host root:After (model configured)