Fix chat composer height race during sidebar open transition#218
Merged
Conversation
The composer textarea had `flex: 1 1 auto` in a column flex container. When the sidebar panel reopened (CSS transition from width 0 → 320px), React mounted the DraftChatPanel and the auto-resize useLayoutEffect fired while the panel was still near-zero width. Setting height to `auto` let flex-grow expand the textarea to fill the degenerate layout, and scrollHeight captured that inflated value (e.g. 392px instead of 72px). The inline height then persisted after the transition completed. Changing to `flex: 0 0 auto` is safe because the JS auto-resize in ChatComposer already handles all height changes — flex-grow on the textarea was redundant and only harmful during transitions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.
Summary
flex: 1 1 auto→flex: 0 0 autoon.composer-input— the JS auto-resize handles all height changes, so flex-grow was redundantRoot cause
When the sidebar panel reopens, the CSS
flex-basistransition starts from 0. React mountsDraftChatPaneland theuseLayoutEffectinChatComposerfires while the panel is still at ~0 width. Settingel.style.height = 'auto'during reflow letsflex-grow: 1expand the textarea to fill the available column height (degenerate layout at 0 width). The resultingscrollHeight(e.g. 392px) gets locked in as the inline height and persists after the transition completes.Test plan
🤖 Generated with Claude Code