Skip to content

Allow RHP text inputs to grow to available height - #98648

Open
KJ21-ENG wants to merge 78 commits into
Expensify:mainfrom
KJ21-ENG:KJ21-ENG/95219-rhp-auto-grow-inputs
Open

KJ21-ENG wants to merge 78 commits into
Expensify:mainfrom
KJ21-ENG:KJ21-ENG/95219-rhp-auto-grow-inputs

Conversation

@KJ21-ENG

@KJ21-ENG KJ21-ENG commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Long text in right-hand-panel editors can stop growing while space remains available. A shared container now measures the remaining panel height so opted-in text inputs grow to that limit and scroll internally, while submit controls and supporting content retain their space.

Following the agreed scope expansion, this covers single primary user-written RHP fields: rejection and hold reasons, titles, workspace/chat/card/tag names, descriptions, notes, and rule text. Name and merchant editors wrap visually and normalize pasted line breaks before validation and saving; prose retains paragraphs. Structured fields, multi-input forms, formula/disabled field variants, and global input defaults retain their existing behavior. In Search, the Description and Title filters grow on narrow and wide layouts (the filter page, the Filters popup and the filter chips), as agreed in the issue; Keyword and the other text filters stay compact.

On narrow web layouts, the Search filter-chip sheet now follows the visual viewport's scroll as well as its resize (FilterPopupButton uses the existing useViewportOffsetTop hook instead of withViewportOffsetTop). In iOS Safari the keyboard can resize the viewport before it scrolls the page to the focused field; the sheet then sat one keyboard height too high, with its field off screen. This already happened on main in some runs; the multi-line Description/Title chip field made it happen most of the time, most likely because the multi-line field changes Safari's keyboard timing. All filter sheets that use FilterPopupButton get the same positioning; desktop is unchanged.

Fixed Issues

$ #95219
PROPOSAL: #95219 (comment)

Tests

Desktop web checks on the updated branch covered policy text, private notes, room/workspace descriptions, workspace names, task titles, default report titles, both rejection editors and the existing narrow/wide Search layouts. Inputs grew to the available-height limit and then scrolled internally; actions and previous-approver controls remained reachable, including through page scrolling where short windows required it. Desktop Enter used the latest typed value, Shift+Enter retained paragraph breaks, and required, length and selection errors kept the editor open. Pasted name line breaks were normalized, and original settings were restored after testing. In Search, Description and Title grew to fill the space above Confirm on both layouts and kept the length error visible; Keyword and the other text filters stayed compact.

Repeat the following checks on the updated branch:

  1. Open a report or expense that can be rejected. Enter a short reason, then enough text to fill the RHP. Verify the input grows, then scrolls internally, with the reject action and previous-approver selector accessible. Repeat for Hold reason without submitting an actual hold.
  2. Open Search > Filters and check each available text filter with short and long values. Verify Confirm stays accessible, Enter applies a valid value, and reopening retains the value. Verify Description and Title grow to fill the space above Confirm on narrow and wide viewports (Filters popup and filter chips), and that their length error stays visible above Confirm. Verify Keyword and the other text filters stay compact. In Description and Title, Enter applies the filter and Shift+Enter inserts a line break (line breaks become spaces in the query). On a phone browser, open the Description chip with a long value and tap the field: the sheet stays docked above the keyboard with the field visible.
  3. Open a single-field name editor, such as workspace name, saved-search rename, card name, or tag name. Enter a long value and then a short value. Paste a name containing line breaks, save, and reopen. Verify it is saved as one line, the input grows and shrinks, and unrelated settings or sibling values are unchanged. Restore the original value.
  4. Open task, room, workspace, or expense description and private-note editors. Enter enough paragraphs to reach the available-height ceiling; verify internal scrolling and reachable actions. Shorten to two paragraphs, save or return to the draft confirmation, and reopen to verify paragraph breaks are retained. Discard unsaved test changes or restore the original value. For the rejection, task-title, room/workspace description, policy-text and private-note editors on desktop, verify Shift+Enter inserts a paragraph and Enter submits a valid latest value. The default report title is single-line: Enter submits it. A required, length or previous-approver selection error should keep the editor open.
  5. Check report TEXT fields and TEXT initial values, default report titles, category description hints, merchant rules and rule descriptions. Verify helper text, match selectors and examples sit right under the input, as on main, and stay visible with the action while the input grows. Names and default report titles normalize line breaks to spaces; prose and other templates retain them.
  6. With long text present, shorten and restore the browser window twice. Verify the maximum height follows the available space and the submit action stays reachable. On mobile, focus, dismiss and reopen the keyboard twice, then rotate where supported. On a short Android screen (for example 360×640dp, or with a larger system font), open the default report title with the keyboard open: verify the input keeps at least one row and the form scrolls to Save.
  7. Trigger required, length or duplicate-value validation where applicable. Verify the error is readable and validation evaluates the same normalized value that will be saved.
  8. In a draft-backed expense editor, change the text, navigate back, cancel the discard prompt and verify the value remains. Then discard and leave without submitting. Repeat equivalent task draft navigation.
  9. Verify structured fields, multi-input creation forms, and formula/disabled report-field branches retain their existing sizing and restrictions. For saved-search rename, verify the existing search is renamed rather than duplicated and a missing search shows the not-found state.
  • Verify that no errors appear in the JS console

Offline tests

  1. Disconnect the network with a supported editor open.
  2. Repeat long/short text, internal scrolling and viewport or keyboard checks. Verify supporting content and actions remain reachable.
  3. In an editor that supports offline saving, change a synthetic value, save and reopen. Reconnect and verify the expected saved value and error handling, then restore the original value.

QA Steps

Same as tests and offline tests, using test accounts on each supported platform. Include both rejection entry points, a report with a previous approver, prose and normalized-name editors, help/selector layouts, draft navigation and excluded inputs.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

Earlier Search/rejection implementation recording.

Screen.Recording.2026-08-17.at.4.03.39.AM.mov
Android: mWeb Chrome

Earlier Search/rejection implementation recording.

Record_2026-08-15-12-58-41.mp4
iOS: Native

Earlier Search/rejection implementation recording.

Simulator.Screen.Recording.-.iPhone.17.-.2026-08-17.at.02.17.16.compressed.mp4
iOS: mWeb Safari

Earlier Search/rejection implementation recording.

Screen.Recording.2026-08-15.at.1.10.08.PM.mov
MacOS: Chrome / Safari

Desktop web — October 13 update, narrow 390×700 window.

Bounded input growth and desktop Enter/Shift+Enter behavior:

Watch recording

Report/expense rejection-editor scrolling, reachable controls and validation:

Watch recording

Earlier desktop recordings:

Screen.Recording.2026-08-15.at.11.15.37.AM.compressed.mp4
pr98648-selected-web-evidence-1.5x.mp4

@codecov

codecov Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/components/Form/FormWrapper.tsx 95.04% <100.00%> (+0.12%) ⬆️
src/components/Rule/TextBase.tsx 93.18% <100.00%> (+93.18%) ⬆️
...ponents/AdvancedFilters/TextInputFilterContent.tsx 100.00% <100.00%> (+2.43%) ⬆️
...mponents/Search/FilterDropdowns/DropdownButton.tsx 100.00% <ø> (ø)
...nents/Search/FilterDropdowns/FilterPopupButton.tsx 100.00% <100.00%> (ø)
...iltersPopup/TextInputFilterContentPopupWrapper.tsx 100.00% <100.00%> (+100.00%) ⬆️
...ponents/Search/FilterDropdowns/TextFilterPopup.tsx 100.00% <100.00%> (+4.16%) ⬆️
...omponents/TextInput/TextInputMeasurement/index.tsx 65.38% <100.00%> (ø)
src/libs/RoomNameInputUtils.ts 100.00% <100.00%> (+100.00%) ⬆️
src/libs/captureInputScrolledToEnd/index.ts 100.00% <100.00%> (ø)
... and 56 more
... and 7389 files with indirect coverage changes

@KJ21-ENG
KJ21-ENG marked this pull request as ready for review August 16, 2026 22:49
@KJ21-ENG
KJ21-ENG requested review from a team as code owners August 16, 2026 22:49
@melvin-bot
melvin-bot Bot requested review from ChavdaSachin and JmillsExpensify and removed request for a team August 16, 2026 22:49
@melvin-bot

melvin-bot Bot commented Aug 16, 2026

Copy link
Copy Markdown

@ChavdaSachin Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team August 16, 2026 22:49
const availableHeightRef = useRef<number>(variables.textInputAutoGrowMaxHeight);
const viewportHeightRef = useRef(windowHeight);
const keyboardHeightRef = useRef(nativeKeyboardHeight);
const lastExactContainerHeightRef = useRef<number | null>(null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ CONSISTENCY-1 (docs)

const isNativePlatform = Platform.OS !== 'web'; gates a large amount of platform-specific behavior inside this single component: the native keyboard-height math (lines 50-51), the native-only branches in the two useLayoutEffects, and the extensive native layout-reconciliation block inside onLayout (lines 160-202). Mixing web and native code paths in one component increases complexity and platform-specific bug risk.

Consider splitting the platform-divergent logic into AutoGrowHeightInputContainer.native.tsx / AutoGrowHeightInputContainer.tsx (web) variants, or extracting the native keyboard/layout reconciliation into a platform-suffixed helper, so each platform's behavior lives in its own file rather than behind isNativePlatform branches.


Reviewed at: c068309 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for flagging this. I left the shared file intentionally. CONSISTENCY-1 is defined around hardcoded platform values or styles, while this code uses the platform check to reconcile coupled keyboard and layout events whose ordering differs across web and native. Splitting this stabilization state machine would duplicate or desynchronize shared ordering logic and carries disproportionate regression risk, so I’m keeping the platform paths together for this PR. The focused tests cover the native and web transition paths, and I’m leaving this thread open for the design discussion.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34940f135c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@JmillsExpensify JmillsExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@ChavdaSachin

ChavdaSachin commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
Screen.Recording.2026-10-30.at.6.50.12.AM.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-10-30.at.5.23.14.AM.mov

…auto-grow-inputs

# Conflicts:
#	src/pages/iou/request/step/DynamicIOURequestStepDescription.tsx
Restarting the clamp at the full slot on every ignored layout grew a filled input past the slot, and the probe that followed shrank it to one row, so its bottom border jumped while the keyboard closed.
…timate

Forms reserve 70% of the bottom inset on iOS. Subtracting the whole inset left the slot about 10pt too tall until keyboardDidShow, so the input shrank again after iOS had scrolled the caret into view, and the caret line was cut off.
@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

@Krishna2323 thanks for testing. I tested each one on main and on this PR (iPhone 17 simulator iOS 26.5, Android API 36 emulator). This PR caused 1, 3 and 4; they're fixed in 32f3d3e. 2 and 5 happen on main too. Main is also merged again to fix the conflicts.

1. iOS Safari: tap outside the input with the keyboard open (fixed)

I couldn't get the page to drop to the middle on iOS 26.5, but the same tap shows the bug behind it. With this PR, the empty space under the input is the auto-grow container, which holds the input. Safari's tap first blurs the input, then puts the caret back into the nearest text inside the tapped box, so the input gets focus again and the keyboard stays open. The blur still runs the form's Safari blur handler, which about a second later lays the page out at full height behind the open keyboard. That's when Save disappears, and probably the jump you saw on iOS 27.2. On main that space is an empty spacer outside the input, so the tap is a normal blur.

The container's empty space is now not selectable, so the tap blurs the input as it does on main. The input and its messages stay selectable. 6 of 6 runs were clean.

1-ios-safari-tap-below-input.mp4

2. iOS Safari: Save stays up after saving

This also happens on main, where it lasts longer: the keyboard closes and Save stays up with the spinner for about 2.1 s on main, versus about 0.6 s on this PR. Since main already does it, I left it out of this PR.

2-ios-safari-save-main-vs-pr.mp4

3. iOS native: caret line hidden at the bottom (fixed)

While the keyboard opens, the container estimates its height. The estimate took away the whole bottom safe area, but forms only reserve 70% of it on iOS, so the estimate was about 10pt too tall. iOS scrolled the caret into view at that height; then the input shrank to its real size and the caret line ended up below the box. The estimate now uses the same safe-area padding as the form, so the size is right from the start. This also fixes an input that stayed at two lines when the app opened straight onto the page.

3-ios-caret-line.mp4

4. iOS native: border jumps when the keyboard closes (fixed)

While the keyboard animates, the container skips some layout updates, but it still restarted its measurement at the full height on each one. A filled input grew past its space, then shrank to one row and grew back, several times during one close. It now keeps the measured height while the keyboard animates and only measures again when the width changes.

4-ios-border-on-keyboard-close.mp4

5. Android: first line flickers on each new line

This also happens on main: on each Return, Android's text field scrolls before React Native updates its height, so the first line is blank for 1–3 frames. The container doesn't measure again on a new line here. With this PR you see it on more lines only because the input keeps growing past main's 115px limit.

5-android-new-line-main-vs-pr.mp4

@grgia
grgia requested a review from Krishna2323 November 25, 2026 12:49
@Krishna2323

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android_hybrid_26.mp4
Android: mWeb Chrome
android_mWeb.mp4
iOS: HybridApp
ios_hybrid.mp4
iOS: mWeb Safari
ios_mWeb.mp4
MacOS: Chrome / Safari
web_chrome_2.mp4
web_chrome.mp4

@Krishna2323 Krishna2323 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@KJ21-ENG could you please resolve the conflicts? Thanks!

@melvin-bot
melvin-bot Bot requested a review from grgia November 25, 2026 22:37
…auto-grow-inputs

# Conflicts:
#	src/components/Form/types.ts
FilterPopupButton read visualViewport.offsetTop only on resize. iOS Safari can
fire the keyboard resize before it scrolls the page to the focused input, so
the sheet kept marginTop 0 with maxHeight set to the shrunk viewport and sat
one keyboard height too high. Use useViewportOffsetTop, which also follows
visualViewport scroll.
@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

@Krishna2323 thanks for the approval. I merged main again (conflict in src/components/Form/types.ts only: main's new scrollViewRef and our shouldConstrainWebContentHeight both kept). Before that I ran one more regression pass of the whole PR against main on web, iOS Safari, Android Chrome, iOS, Android and iPad, and fixed what it found:

  1. Search Description/Title filter, web: the length error could sit behind Confirm. The filter's scroll content is now bounded on web, like the form pages, so the input shrinks when the error appears. It keeps one row on very short windows and leaves 12px above Confirm.
A1-wide-compare.mp4
  1. Merchant to match, web: a long value showed one row for a few frames when returning from Match type. A hidden screen reports an empty layout, which the container now ignores.

  2. Web: after pasting into a full-height input, the last line could stay cut off until the next key press. Chrome stops 2px short of the end, and the restore only allowed 1px.

L1a-desktop-compare.mp4
  1. Search filter chips, iOS Safari: the chip sheet could open one keyboard height too high, with the field off screen. This also happens on main (4 of 10 runs), but the multi-line Description/Title field made it happen most of the time. FilterPopupButton now uses the existing useViewportOffsetTop hook, which follows the viewport's scroll as well as its resize. With the fix it happened in 0 of 31 runs (Description and Title, some with the page slowed on purpose); the other filter sheets behave the same as on main on iOS Safari and Android Chrome. The video shows main good, main bad, this PR before the fix, and the fix.
S1-compare-4up.mp4

@grgia one design question before merge: on four screens the helper content now sits at the bottom, above the action, instead of right under the input, because the input takes the space in between. Is that OK, or should it stay under the input?

Default report title Merchant to match
Default report title Merchant to match
Reject report Category description hint
Reject report Category description hint

@grgia

grgia commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

@grgia one design question before merge: on four screens the helper content now sits at the bottom, above the action, instead of right under the input, because the input takes the space in between. Is that OK, or should it stay under the input?

Case: A user on Description hint, Default report title or Merchant to match sees the pro-tip, the examples or the Match type row at the bottom of the panel, far from the field.

@KJ21-ENG no to this one. That would become a regression, could we match main?

Default report title examples, the Merchant to match type row, the description hint tip and the reject previous-approver choice now render inside the measured content, so they sit under the input as on main and the input only grows into the space below them.
@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

@grgia done. The helper content is back right under the input, as on main:

  • Default report title: the examples
  • Merchant to match: Match type
  • Description hint: the pro-tip
  • Reject report: the previous-approver choice

The input still grows, but only into the space below the helper, so the helper and the button stay visible.

Default report title Merchant to match Description hint
Default report title Merchant to match Description hint

Each image shows main, this PR before the change, and this PR now. With a long value, the input fills the space above the helper (normal and short window):

Long value

@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

@grgia @Krishna2323 one Android behaviour to flag before you sign off, so it isn't a surprise in QA.

What happens: on Android, when the keyboard opens on a long value, the input is too tall for a moment. For about 0.2–0.5 s it hides its label, its last line and the helper under it (for example the Pro-tip), then it settles with everything visible. On some opens the input first shrinks to about 2 rows for up to 0.35 s, then grows back. iOS native and web don't do this.

Why: the input works out its new height a few frames after Android shrinks the panel for the keyboard, so for that moment it still has the height it had before. This affects every input in this PR that grows, including screens that have no helper, such as Workspace description. Now that the helper sits right under the input, as on main, the short overlap is easier to see.

Compared with main: main has its own blink at the same moment. On some keyboard opens the whole page is blank for 0.3–0.47 s. The video plays both side by side (Description hint, slow motion, then real speed):

android-keyboard-gap-explained.mp4

Times come from an Android emulator running production-mode JS, over 3 keyboard opens per screen. On a dev build the same gap is 1.7–4.3 s, so it will look much bigger there.

Screen main this PR
Description hint page blank 0–0.47 s helper hidden 0.18–0.43 s
Default report title nothing hidden 0.23–0.53 s
Merchant to match → Match type → back nothing hidden 0.27–0.30 s
Workspace description (no helper) page blank 0–0.30 s label/last line hidden 0.19–0.44 s

I tried one fix: on a height-only change, the input keeps the space the helper already has. It shortened the gap on Match type but made it longer on Default report title, so I didn't push it. Removing the gap fully would mean resizing the input in the same pass as the keyboard, which is a bigger change to the shared container.

Are you OK with this as is, or would you like me to work on removing it in this PR?

maxAutoGrowHeight={maxAutoGrowHeight}
/>
</View>
{/* The approver choice stays right under the input, inside the measured content, so the input only grows into the space left below it. */}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NAB

an approver on a small phone sees one line of their rejection reason while typing it, where main shows four.

with the keyboard open and a long reason the input drops to one row at 375x667 and 360x640, and three rows at 390x844. is that intended now the approver choice sits inside the measured content? checked in Chrome phone emulation with the window shortened for the keyboard, not on a device.

reject-375x407-keyboard-main-vs-pr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@grgia not intended, thanks for catching it. Fixed in 2e26224: content under the input can no longer squeeze it below main's cap (115px, about four lines). Whatever doesn't fit scrolls inside the panel, and the Reject report button stays visible.

Same check as yours (Chrome, window shortened by ~260px for the keyboard, long reason):

Size main before now
375x407 4 rows 1 row 4 rows
360x380 4 rows 1 row 4 rows
390x584 4 rows 6 rows 6 rows
Reject report at 375x407: main, before, now

The same rule covers the other screens with content under the input. On Default report title at 375x407 the input now keeps 4 rows instead of 3, so the last example needs a short scroll. On main you also scroll there, to reach Save.

… less room

On a short screen with the keyboard open, the approver list on Reject report left one row for the rejection reason, where main shows four. The content that does not fit now scrolls in the slot instead.
@Krishna2323

Copy link
Copy Markdown
Contributor

Reviewing...

@KJ21-ENG

KJ21-ENG commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

@grgia @Krishna2323 please hold this PR for now, don't merge yet. An extra regression pass on 2e26224 found cases on very short screens that I want to fix first:

  1. With about 300–380px of height (for example a small Android phone in Chrome with the keyboard open), the new minimum doesn't count the field's own padding and error. A markdown field can be cut off at the bottom, and the "Character limit exceeded" error can end up out of view.
  2. Below about 300px the input still shows fewer rows than main.
  3. On iOS, Default report title can stay at one row when the page opens with the keyboard already up.

I'm testing a fix now and will post the results here when it's ready.

…the input, and count the iOS keyboard once

On a short screen the fixed cap left no room for the input's own frame or its error, and below about 300px the slot could not
even hold the cap, so markdown boxes were cut, errors were hidden and inputs showed fewer rows than before they could grow. The
content below the input also scrolled inside the slot, which has no scrollbar, so the input's label or that content could sit
out of view. When the slot cannot hold its content with the input at the fixed cap, it now grows to hold all of it, following
the content as errors appear or lines change, and the form scrolls as it did before. A web resize no longer estimates a slot
taller than the one laid out.

On iOS a screen opened by a link with its input focused laid the slot out at its keyboard-open size about 30ms before the keyboard
state updated, so the keyboard was subtracted twice and the input stayed at one row. A settled layout change that matches the
keyboard that soon before it is now treated as the keyboard.
@KJ21-ENG

KJ21-ENG commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@grgia @Krishna2323 the hold can be lifted. Fixed in ea52351.

  • Short screens: when the input at its old four-line size plus the content under it doesn't fit (a small phone with the keyboard open), the page now scrolls the way main does. It no longer squeezes the input or scrolls that content inside the panel. The input never shows fewer rows than main, and its frame, its label and the "Character limit exceeded" error stay visible.
  • iOS: opening Default report title from a link no longer leaves the input at one row. The keyboard height was being subtracted twice.

Rows shown in Chrome, with the window shortened for the keyboard ("before" is 2e26224):

Screen Size main before now
Reject report (with approver list) 375x407 4 4 4
Reject report (with approver list) 360x280 4 3 4
Default report title 360x260 4 1 4
Description hint 360x300 5 0, box cut 5
Workspace description, over the limit 360x300 5, error shown 1, error hidden 5, error shown

This changes what I described earlier for Reject report on a short phone. At 375x407 and 360x380 it now matches main: the approver list shows under the reason, and the Reject report button is below the fold, reached by scrolling. Taller phones and desktop are unchanged.

One known difference: on a small Android phone (360x640) with the keyboard open, Reject report sometimes opens with the page scrolled up about 110px, so the field's label sits above the visible area. The input still shows four rows with the caret, the approver list stays visible, and scrolling up shows the label. Main didn't do this in my runs.

Tested on Chrome at short heights from 407 down to 240 and in landscape, on the iPhone SE simulator and on an Android emulator at 360x640.

…auto-grow-inputs

# Conflicts:
#	src/pages/workspace/fields/FieldsInitialValuePage.tsx
#	src/pages/workspace/taxes/NamePage.tsx

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants