feat(composer): add resizable input height#16707
Merged
Merged
Conversation
Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
…put-style Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com> # Conflicts: # src/renderer/components/composer/ComposerSurface.tsx
eeee0717
approved these changes
Jul 3, 2026
eeee0717
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed head 4d09d47.
No substantive issues found. The resizable composer height logic is separated into a focused sizing hook, the shared resize-drag hook preserves cleanup/cancellation behavior, and the PR adds targeted pointer, keyboard, clamp, restore, and accessibility coverage. GitHub CI relevant checks are passing; general-test is skipped. Residual risk is live Electron/UI feel across layouts, which CI does not fully validate.
AtomsH4
reviewed
Jul 3, 2026
Collaborator
There was a problem hiding this comment.
This review was translated automatically.
Blocker
None.
Warning
src/renderer/components/composer/useComposerEditorFrameSizing.ts:198-toggleExpanded(false)doesn't handle existingmanualHeight, collapse after external expand will bounce back to old manual height.
Failure path: User first manually drags to create a custom height, thencomposerQuote.ts:34can force expand viaactionsRef.current.toggleExpanded(true); subsequently pressing Escape in the editor will calltoggleEditorExpanded(false)viaComposerSurface.tsx:1190. The effect first animates to the default collapsed height, but afteranimatedHeightis cleared,resolvedFrameHeightatuseComposerEditorFrameSizing.ts:275falls back to the still-unclearedmanualHeight, causing the UI to jump from collapsed height back to the old custom height, and the button remains in restore state.
Minimal fix: Clarify the semantics of collapse. IftoggleExpanded(false)should restore to default collapsed height, then clearmanualHeightin that path; if it should return to manual height, then don't set the animation target to collapsed content height, and add a test for "manual resize → external toggleExpanded(true) → Escape/toggle false".
Notice
None.
Focused Tests
- Sub-agent ran:
pnpm exec vitest run --project renderer src/renderer/components/composer/__tests__/ComposerSurface.test.tsx src/renderer/hooks/__tests__/useResizeDrag.test.tsx, 2 files / 82 tests passed; output includes existing Reactact(...)warnings.
Original Content
Blocker
无。
Warning
src/renderer/components/composer/useComposerEditorFrameSizing.ts:198-toggleExpanded(false)没有处理已存在的manualHeight,外部展开后的 collapse 会回弹到旧手动高度。
Failure path: 用户先手动拖拽出 custom height 后,composerQuote.ts:34可以通过actionsRef.current.toggleExpanded(true)强制展开;随后编辑器内按 Escape 会走ComposerSurface.tsx:1190调用toggleEditorExpanded(false)。effect 会先动画到默认折叠高度,但animatedHeight清空后resolvedFrameHeight在useComposerEditorFrameSizing.ts:275又回落到仍未清除的manualHeight,UI 从折叠高度跳回旧 custom height,按钮也继续处于 restore 状态。
Minimal fix: 明确 collapse 语义。若toggleExpanded(false)应恢复默认折叠高度,则在该路径清除manualHeight;若应回到手动高度,则不要把动画目标设为 collapsed content height,并补一个 "manual resize → external toggleExpanded(true) → Escape/toggle false" 测试。
Notice
无。
Focused Tests
- 子 agent ran:
pnpm exec vitest run --project renderer src/renderer/components/composer/__tests__/ComposerSurface.test.tsx src/renderer/hooks/__tests__/useResizeDrag.test.tsx,2 files / 82 tests passed;输出包含现有 Reactact(...)warning。
Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
Collaborator
Author
|
Addressed in
Verified:
|
The expand/restore button was permanently visible whenever the user dragged the input to a custom height, which felt intrusive. The corner arc decoration now stays visible at all times as a hover affordance, and the action button only appears on hover/focus as intended. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
… button Button is no longer forced visible (opacity-100) when custom height is set; corner arc is no longer hidden (opacity-0 scale-50) in the same state. Update the test to assert the new hover-only behaviour for both elements. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: jd <59188306+zhangjiadi225@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Before this PR:
The shared chat/agent composer input could be expanded with the corner button, but users could not manually adjust the input height.
After this PR:
The shared composer input supports temporary drag resizing from a top separator, keyboard resizing through the separator, and a unified corner control that restores the default height from either expanded or manually resized states.
Fixes # N/A
Why we need it and why it was done in this way
The following tradeoffs were made:
The manual height is intentionally renderer-local state only, so resizing does not persist across app restarts. The resize state machine is kept in
useComposerEditorFrameSizingto keepComposerSurfacefocused on rendering and composer behavior.The following alternatives were considered:
Persisting the height in renderer cache was considered first, but the product direction changed to temporary frontend state. Adding a generic resizing panel dependency was also avoided because this is a narrow vertical resize interaction.
Links to places where the discussion took place: N/A
Breaking changes
If this PR introduces breaking changes, please describe the changes and the impact on users.
None.
Special notes for your reviewer
Validation performed:
pnpm lintpassed with existing repository warnings only.pnpm exec vitest run --project renderer src/renderer/components/composer/__tests__/ComposerSurface.test.tsx src/renderer/hooks/__tests__/useResizeDrag.test.tsxpassed: 2 files, 73 tests.Not run per project/user override:
pnpm build:check, fullpnpm test.Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
mainfor active development,v1for v1 maintenance fixes/gh-pr-review,gh pr diff, or GitHub UI) before requesting review from othersRelease note