You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$175] Composer - Input field renders at two-line height before typing starts #103497
Version Number: Reproducible in staging?: Needs Reproduction (Unable to reproduce) Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@AndrewGable Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Open a DM
Look at the composer ("Write something...") before typing anything.
Start typing a message.
Expected Result:
The composer should render at a single-line height by default
Actual Result:
The composer appears at a two-line height while empty/showing the placeholder
Workaround:
Unknwon
Platforms:
Select the officially supported platforms where the issue was reproduced:
Reproduced on web. The bug happens when you send a restored draft without editing it, and the draft was one long line that wrapped to 2 lines:
In a DM, type one long line that wraps to 2 lines. Do not use Enter or Shift+Enter.
Leave the chat and come back, or reload, so the composer reloads with the draft.
Send it without editing.
The empty composer stays at 2-line height, with the placeholder at the top, until you type.
Sending a newly typed multi-line message does not trigger it. This explains why QA could not reproduce it.
What is the root cause of that problem?
The composer saves the first height it measures as the "empty" height. The guard only skips text that contains \n. See ComposerWithSuggestions.tsx:1007-1009.
When the composer loads with a long wrapped draft, its first measurement is 2 lines tall. That value is saved as the "empty" height, because the draft has no \n.
On send, resetHeight() fixes the composer at that saved 2-line height. The fixed height is only removed when onContentSizeChange fires (:1004) or when the user types (:689). The new height matches the last measured height, so no size change fires. The composer stays at 2 lines.
What changes do you think we should make in order to solve the problem?
In ComposerWithSuggestions.tsx:
Save the empty height only when the input is actually empty (valueRef.current === ''), not just when it has no \n.
Stop relying on onContentSizeChange to remove the fixed height. Clear composerHeightAfterClear on the next animation frame after it is set.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/103497) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
changed the title [-]Composer - Input field renders at two-line height before typing starts[/-][+][$175] Composer - Input field renders at two-line height before typing starts[/+]on Oct 8, 2026
Please re-state the problem that we are trying to solve in this issue.
In a chat or DM, the message composer renders at a two-line height while empty and showing the placeholder ("Write something..."), instead of rendering at a single-line height. The composer remains stuck at two lines until the user starts typing.
What is the root cause of that problem?
In src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx (lines 1007–1009):
// Store the default collapsed composer height, so we can later reset the height when we clear the input.if(emptyComposerHeightRef.current===null&&inputHeight>0&&!valueRef.current.includes('\n')){emptyComposerHeightRef.current=inputHeight;}
The code attempts to measure and store the initial collapsed height of an empty composer into emptyComposerHeightRef.current. However, it uses !valueRef.current.includes('\n') as the predicate. If a draft message was restored upon opening the report (or typed without explicit newlines) that wraps across 2 lines, its height exceeds a single line but contains no \n. Consequently, emptyComposerHeightRef.current captures the 2-line wrapped height instead of the single-line baseline height.
When the user sends the draft message, resetHeight() (lines 850–855) assigns setComposerHeightAfterClear(emptyComposerHeightRef.current), locking the empty composer to the erroneously stored 2-line height.
clearComposerHeight() is only called inside handleContentSizeChange. Because the empty input does not fire a subsequent content size change event after submission, the composer stays pinned to the 2-line height until the user types.
What changes do you think we should make in order to solve the problem?
In src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:
Only record baseline height when input is truly empty:
Update the condition in handleContentSizeChange so emptyComposerHeightRef.current is only captured when the input contains no text:
This guarantees that long wrapped drafts or multi-line messages without newlines never poison emptyComposerHeightRef.current.
Auto-release temporary height lock after clear:
In resetHeight(), schedule clearComposerHeight() via requestAnimationFrame so the temporary height lock applied during submission prevents cursor flashing/jumping while immediately relinquishing fixed height back to flex layout:
What alternative solutions did you explore? (Optional)
Hardcoding line height constants: Calculating height statically using font size and vertical padding misses platform-specific font rendering metrics (Android vs iOS vs Web). Capturing the true measured height when valueRef.current.trim() === '' preserves exact native measurement without hardcoding.
What specific scenarios should we cover in automated tests?
In tests/unit/ComposerWithSuggestionsTest.tsx:
When handleContentSizeChange fires with non-empty text lacking newlines (e.g. wrapped draft), verify that emptyComposerHeightRef.current is not set.
When handleContentSizeChange fires with empty text (""), verify that emptyComposerHeightRef.current is recorded.
Verify that sending a multi-line or wrapped message resets the composer to the single-line height and releases the fixed height lock.
Please re-state the problem that we are trying to solve in this issue.
The empty message composer can remain at a two-line height instead of collapsing back to the normal single-line height after a restored wrapped draft is sent.
What is the root cause of that problem?
The composer caches its "empty" height from the first measured content height using a condition that only excludes values containing a newline.
A restored draft can wrap onto two visual lines without containing \n. In that case the composer records that wrapped two-line measurement as emptyComposerHeightRef.current. When the draft is sent, resetHeight() restores that incorrect cached value, so the now-empty composer remains two lines tall until another content-size change or user input clears the fixed height.
What changes do you think we should make in order to solve the problem?
Only record emptyComposerHeightRef.current when the composer value is actually empty, not merely newline-free.
Ensure the temporary fixed height used during clear/reset is released deterministically after the reset instead of depending only on a subsequent onContentSizeChange.
Keep the existing anti-flicker behavior intact and add regression coverage for a restored long single-line draft that visually wraps, is sent without editing, and must return to the normal one-line empty composer height.
What alternative solutions did you explore? (Optional)
Hardcoding the single-line height would avoid the stale measurement but would be more fragile across platforms/font metrics. Reusing the measured empty state is safer as long as it is captured only from a truly empty composer.
Please re-state the problem that we are trying to solve in this issue.
In a chat or DM, after sending a restored wrapped draft message, the empty composer remains stuck at a two-line height with the placeholder visible, instead of collapsing back down to a single-line height.
What is the root cause of that problem?
In src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx (lines 1006–1009):
// Store the default collapsed composer height, so we can later reset the height when we clear the input.if(emptyComposerHeightRef.current===null&&inputHeight>0&&!valueRef.current.includes('\n')){emptyComposerHeightRef.current=inputHeight;}
The code attempts to cache the baseline empty collapsed composer height into emptyComposerHeightRef.current. However, it guards with !valueRef.current.includes('\n').
When a chat is opened with an existing restored draft that visually wraps onto 2 lines without containing an explicit newline (\n), the first handleContentSizeChange measurement captures the 2-line wrapped height and erroneously stores it into emptyComposerHeightRef.current.
When the user submits the draft without editing, resetHeight() (lines 850–855) sets composerHeightAfterClear to emptyComposerHeightRef.current (2-line height).
clearComposerHeight() is only triggered when a subsequent handleContentSizeChange or onChangeText event occurs. Because the input is now empty and no new text is being typed, no further content size changes fire, leaving the composer pinned to the 2-line height until the user starts typing.
What changes do you think we should make in order to solve the problem?
In src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:
Only record baseline collapsed height when the input is actually empty:
This guarantees that wrapped drafts without newlines will never contaminate emptyComposerHeightRef.current.
Handle fallback and release height lock deterministically in resetHeight():
constresetHeight=useCallback(()=>{if(!emptyComposerHeightRef.current){// If the composer mounted with an existing draft and emptyComposerHeightRef was never recorded,// clear the manual height immediately to let natural flexbox layout collapse to 1 linesetComposerHeightAfterClear(null);return;}setComposerHeightAfterClear(emptyComposerHeightRef.current);requestAnimationFrame(()=>{clearComposerHeight();});},[clearComposerHeight]);
Why this works:
If the chat was opened empty, emptyComposerHeightRef.current cleanly records the true 1-line measured height. When submitting any multi-line or wrapped message, resetHeight() locks it to 1 line to prevent layout flashing, then releases it on the next paint frame via requestAnimationFrame.
If the chat was opened with an existing draft (where emptyComposerHeightRef was never set), resetHeight() explicitly resets setComposerHeightAfterClear(null), allowing the empty TextInput to naturally collapse to 1 line via flexbox with zero stuck height.
What alternative solutions did you explore? (Optional)
Hardcoding line height constants: Calculating height statically using font size and padding misses platform-specific font metrics and OS font scaling (iOS Dynamic Type, Android font scaling). Measuring dynamically when valueRef.current.trim() === '' with an unconstrained fallback is safer and cross-platform native.
Please re-state the problem that we are trying to solve in this issue.
The empty message composer renders stuck at a two-line height with the placeholder visible instead of collapsing back down to a single-line height after sending a draft.
What is the root cause of that problem?
In src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:
The check uses !valueRef.current.includes('\n'). When a conversation opens with an existing saved draft that visually wraps onto 2 lines without explicit newline characters (\n), the initial handleContentSizeChange measures the 2-line wrapped height and incorrectly saves it as emptyComposerHeightRef.current.
2. When the user sends the draft, resetHeight() sets composerHeightAfterClear to emptyComposerHeightRef.current (which is poisoned with the 2-line measurement). Because the composer is now empty and no subsequent input events fire, clearComposerHeight() is never called, leaving the empty composer stuck at 2-line height.
What changes do you think we should make in order to solve the problem?
In src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:
Only record baseline collapsed height when the input is actually empty (valueRef.current.trim() === ''):
In resetHeight(), if emptyComposerHeightRef.current was not recorded (e.g., opened with an existing long draft), reset setComposerHeightAfterClear(null) immediately to allow native flex layout to settle at single-line height.
Automatically release the temporary height lock via requestAnimationFrame(() => clearComposerHeight()) so layout flickering is prevented during message submission while ensuring the composer returns to natural single-line height.
Tested and pre-coded on branch fix/103497-composer-empty-height.
The supplied web session displayed a blank page, so no composer behavior could be tested. This is not a confirmed regression.
Step
Status
Open a DM with an empty, one-line composerBlocked: no accessible UI rendered.
❌
Type a single line that wraps to two lines without EnterNot executed because the app UI was unavailable.
❌
Switch chats and verify the wrapped draft is restoredNot executed because the app UI was unavailable.
❌
Send the restored draft without editing; composer returns to and remains one lineNot executed because the app UI was unavailable.
❌
Send a freshly typed wrapped message; composer returns to one lineNot executed because the app UI was unavailable.
❌
Send an expanded multiline message without cursor/placeholder flash or height regressionNot executed because the app UI was unavailable.
❌
Created draft implementation: Prevent restored drafts from keeping the empty composer expanded, assigned to situchan. All 37,016 executed Jest tests passed, including seven new regression cases. Lint, types, spelling, explicit-path React Compiler checks, and Storybook smoke checks passed. The formatter check was unavailable; details are in the PR.
Please complete web verification before marking the draft ready for review.
Activity
MelvinBot commentedon Oct 8, 2026
Proposal
Reproduced on web. The bug happens when you send a restored draft without editing it, and the draft was one long line that wrapped to 2 lines:
Sending a newly typed multi-line message does not trigger it. This explains why QA could not reproduce it.
What is the root cause of that problem?
The composer saves the first height it measures as the "empty" height. The guard only skips text that contains
\n. SeeComposerWithSuggestions.tsx:1007-1009.When the composer loads with a long wrapped draft, its first measurement is 2 lines tall. That value is saved as the "empty" height, because the draft has no
\n.On send,
resetHeight()fixes the composer at that saved 2-line height. The fixed height is only removed whenonContentSizeChangefires (:1004) or when the user types (:689). The new height matches the last measured height, so no size change fires. The composer stays at 2 lines.What changes do you think we should make in order to solve the problem?
In
ComposerWithSuggestions.tsx:valueRef.current === ''), not just when it has no\n.onContentSizeChangeto remove the fixed height. ClearcomposerHeightAfterClearon the next animation frame after it is set.Part 2 alone fixes the stuck state. Part 1 stops the wrong value from being saved. Retest the cursor flash fixed in Fix cursor moves to write something briefly with expand compose box, which added this height-reset logic.
What alternative solutions did you explore? (Optional)
Compute the empty height from styles (line height plus vertical padding) instead of measuring it.
Reproduction screenshots (web, dev)
Restored 2-line draft before sending:

Empty composer still taller than one line, 3 seconds after sending:

Back to one line after typing one character:

The tester measured heights from screenshots. It could not read DOM values directly.
Other details
:empty::beforein react-native-live-markdown).resetHeightcall inuseComposerSubmit.ts:178. No PR from August to October 2026 changed it.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/103497)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run · view recording
melvin-bot commentedon Oct 8, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (
External)[-]Composer - Input field renders at two-line height before typing starts[/-][+][$175] Composer - Input field renders at two-line height before typing starts[/+]melvin-bot commentedon Oct 8, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022108247042353130137
RajGahoi commentedon Oct 8, 2026
Contributor details
Your Expensify account email: gahoiraj01@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01b77415f16d156068
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a chat or DM, the message composer renders at a two-line height while empty and showing the placeholder ("Write something..."), instead of rendering at a single-line height. The composer remains stuck at two lines until the user starts typing.
What is the root cause of that problem?
In
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx(lines 1007–1009):emptyComposerHeightRef.current. However, it uses!valueRef.current.includes('\n')as the predicate. If a draft message was restored upon opening the report (or typed without explicit newlines) that wraps across 2 lines, its height exceeds a single line but contains no\n. Consequently,emptyComposerHeightRef.currentcaptures the 2-line wrapped height instead of the single-line baseline height.resetHeight()(lines 850–855) assignssetComposerHeightAfterClear(emptyComposerHeightRef.current), locking the empty composer to the erroneously stored 2-line height.clearComposerHeight()is only called insidehandleContentSizeChange. Because the empty input does not fire a subsequent content size change event after submission, the composer stays pinned to the 2-line height until the user types.What changes do you think we should make in order to solve the problem?
In
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:Only record baseline height when input is truly empty:
Update the condition in
handleContentSizeChangesoemptyComposerHeightRef.currentis only captured when the input contains no text:This guarantees that long wrapped drafts or multi-line messages without newlines never poison
emptyComposerHeightRef.current.Auto-release temporary height lock after clear:
In
resetHeight(), scheduleclearComposerHeight()viarequestAnimationFrameso the temporary height lock applied during submission prevents cursor flashing/jumping while immediately relinquishing fixed height back to flex layout:What alternative solutions did you explore? (Optional)
valueRef.current.trim() === ''preserves exact native measurement without hardcoding.What specific scenarios should we cover in automated tests?
In
tests/unit/ComposerWithSuggestionsTest.tsx:handleContentSizeChangefires with non-empty text lacking newlines (e.g. wrapped draft), verify thatemptyComposerHeightRef.currentis not set.handleContentSizeChangefires with empty text (""), verify thatemptyComposerHeightRef.currentis recorded.melvin-bot commentedon Oct 8, 2026
Details
krsnak commentedon Oct 8, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
The empty message composer can remain at a two-line height instead of collapsing back to the normal single-line height after a restored wrapped draft is sent.
What is the root cause of that problem?
The composer caches its "empty" height from the first measured content height using a condition that only excludes values containing a newline.
A restored draft can wrap onto two visual lines without containing
\n. In that case the composer records that wrapped two-line measurement asemptyComposerHeightRef.current. When the draft is sent,resetHeight()restores that incorrect cached value, so the now-empty composer remains two lines tall until another content-size change or user input clears the fixed height.What changes do you think we should make in order to solve the problem?
emptyComposerHeightRef.currentwhen the composer value is actually empty, not merely newline-free.onContentSizeChange.What alternative solutions did you explore? (Optional)
Hardcoding the single-line height would avoid the stale measurement but would be more fragile across platforms/font metrics. Reusing the measured empty state is safer as long as it is captured only from a truly empty composer.
ashusatyarthi-wq commentedon Oct 8, 2026
Contributor details
Your Expensify account email: ashusatyarthi@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~010e53044b5828fe60
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a chat or DM, after sending a restored wrapped draft message, the empty composer remains stuck at a two-line height with the placeholder visible, instead of collapsing back down to a single-line height.
What is the root cause of that problem?
In
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx(lines 1006–1009):emptyComposerHeightRef.current. However, it guards with!valueRef.current.includes('\n').\n), the firsthandleContentSizeChangemeasurement captures the 2-line wrapped height and erroneously stores it intoemptyComposerHeightRef.current.resetHeight()(lines 850–855) setscomposerHeightAfterCleartoemptyComposerHeightRef.current(2-line height).clearComposerHeight()is only triggered when a subsequenthandleContentSizeChangeoronChangeTextevent occurs. Because the input is now empty and no new text is being typed, no further content size changes fire, leaving the composer pinned to the 2-line height until the user starts typing.What changes do you think we should make in order to solve the problem?
In
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:This guarantees that wrapped drafts without newlines will never contaminate
emptyComposerHeightRef.current.resetHeight():Why this works:
emptyComposerHeightRef.currentcleanly records the true 1-line measured height. When submitting any multi-line or wrapped message,resetHeight()locks it to 1 line to prevent layout flashing, then releases it on the next paint frame viarequestAnimationFrame.emptyComposerHeightRefwas never set),resetHeight()explicitly resetssetComposerHeightAfterClear(null), allowing the empty TextInput to naturally collapse to 1 line via flexbox with zero stuck height.What alternative solutions did you explore? (Optional)
valueRef.current.trim() === ''with an unconstrained fallback is safer and cross-platform native.melvin-bot commentedon Oct 8, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
jloa-dev commentedon Oct 10, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
The empty message composer renders stuck at a two-line height with the placeholder visible instead of collapsing back down to a single-line height after sending a draft.
What is the root cause of that problem?
In
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:The check uses
!valueRef.current.includes('\n'). When a conversation opens with an existing saved draft that visually wraps onto 2 lines without explicit newline characters (\n), the initialhandleContentSizeChangemeasures the 2-line wrapped height and incorrectly saves it asemptyComposerHeightRef.current.2. When the user sends the draft,
resetHeight()setscomposerHeightAfterCleartoemptyComposerHeightRef.current(which is poisoned with the 2-line measurement). Because the composer is now empty and no subsequent input events fire,clearComposerHeight()is never called, leaving the empty composer stuck at 2-line height.What changes do you think we should make in order to solve the problem?
In
src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions.tsx:valueRef.current.trim() === ''):resetHeight(), ifemptyComposerHeightRef.currentwas not recorded (e.g., opened with an existing long draft), resetsetComposerHeightAfterClear(null)immediately to allow native flex layout to settle at single-line height.requestAnimationFrame(() => clearComposerHeight())so layout flickering is prevented during message submission while ensuring the composer returns to natural single-line height.Tested and pre-coded on branch
fix/103497-composer-empty-height.Contributor details
Your Expensify account email: jloa.dev@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0163955a2ba22190aa
34 remaining items
melvin-bot commentedon Nov 3, 2026
@situchan 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
melvin-bot commentedon Nov 4, 2026
@situchan 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
melvin-bot commentedon Nov 4, 2026
@situchan 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
situchan commentedon Nov 4, 2026
@MelvinBot draft implementation for your proposal
MelvinBot commentedon Nov 4, 2026
🤖 Web test steps verification results: ❌ fail
The supplied web session displayed a blank page, so no composer behavior could be tested. This is not a confirmed regression.
Open a DM with an empty, one-line composer
Blocked: no accessible UI rendered.Type a single line that wraps to two lines without Enter
Not executed because the app UI was unavailable.Switch chats and verify the wrapped draft is restored
Not executed because the app UI was unavailable.Send the restored draft without editing; composer returns to and remains one line
Not executed because the app UI was unavailable.Send a freshly typed wrapped message; composer returns to one line
Not executed because the app UI was unavailable.Send an expanded multiline message without cursor/placeholder flash or height regression
Not executed because the app UI was unavailable.Created draft implementation: Prevent restored drafts from keeping the empty composer expanded, assigned to
situchan. All 37,016 executed Jest tests passed, including seven new regression cases. Lint, types, spelling, explicit-path React Compiler checks, and Storybook smoke checks passed. The formatter check was unavailable; details are in the PR.Please complete web verification before marking the draft ready for review.
view run · no recording available
melvin-bot commentedon Nov 5, 2026
@situchan this issue is now 4 weeks old, please consider:
Thanks!
jeffrey-graham commentedon Nov 7, 2026
melvin-bot commentedon Nov 7, 2026
melvin-bot commentedon Nov 10, 2026
@situchan Eep! 4 days overdue now. Issues have feelings too...
AndrewGable commentedon Nov 13, 2026
I can't reproduce anymore, I think we can close. If anyone disagrees, let me know