Repository navigation
fix report title box is not scrolled to the bottom after pasting several lines of text - #100392
Conversation
…ral lines of text
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@apeyada Is this PR ready for review? Its missing the appropriate screenshots and videos. Could you also dial back the overly verbose nature of the PR description. cc: @mkhutornyi & @chuckdries |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
PR is ready for review. Note: On mobile safari, scroll doesn't happen at all but it's a different bug happening on production with different root cause. mobile.safari.mov |
|
@MelvinBot review |
🤖 Review — approve with non-blocking suggestionsThe diagnosis and the fix hold up. I re-derived the arithmetic against the real style tree and it lands exactly where the PR says:
They now agree, so the box no longer resizes under the browser's scroll offset. The tallest pre-flip content is 4 lines ( Suggestions (none blocking)1. The label-padding term is coupled by coincidence. 2. 3. 4. Near-duplicate of the helper directly above it. 5. Test nits. The two branches the new helper adds over the existing one — 🤖 Web test steps verification results: ✅ pass I ran the PR's test steps on the Console errors could not be captured — log collection is unsupported for web in this session. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.ios.movAndroid: mWeb ChromeiOS: HybridAppandroid.ios.moviOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
chuckdries
left a comment
There was a problem hiding this comment.
Not sure if this is an issue, but it seems like it may end up not scrolling when it should (maybe only an edge case with non-standard font sizes or zoom levels?)
| */ | ||
| getAutoGrowHeightInputStyle: (textInputHeight: number, maxHeight: number): ViewStyle => { | ||
| getAutoGrowHeightInputStyle: (textInputHeight: number, maxHeight: number, verticalInset: number): ViewStyle => { | ||
| if (textInputHeight > maxHeight) { |
There was a problem hiding this comment.
Can you help me understand why this shouldn't be
| if (textInputHeight > maxHeight) { | |
| if (textInputHeight > (maxHeight - verticalInset)) { |
There was a problem hiding this comment.
textInputHeight isn't the height of the text. It's the height of the hidden <Text> we measure with, and that one still carries baseTextInput's paddingTop: 15 / paddingBottom: 8 (the real input has them zeroed by pv0).
So it's 23 + lines × 20, which is the same scale as maxAutoGrowHeight - the container height is literally textInputHeight + 8.
verticalInset takes you out of that scale and into the input's own box, so subtracting it here compares two different things.
In practice it would flip one line too early.
At 4 lines textInputHeight is 103 and the container is 111 tall, so there's 82px of room for 80px of text - it fits fine, nothing needs to scroll.
But 103 > 115 - 29 is true, so we'd drop the fixed height and switch to overflow: auto anyway, which is the scrollbar flash the fixed height is there to prevent.
apeyada
left a comment
There was a problem hiding this comment.
Not sure if this is an issue, but it seems like it may end up not scrolling when it should (maybe only an edge case with non-standard font sizes or zoom levels?)
You're right that there's a case where it doesn't scroll when it should, but it takes a font scale around 1.1 (~110% zoom) and exactly 4 lines, and then ~3px of the last line is out of reach.
It's not new either:
- before this PR, the container clipped those same 3px and you couldn't scroll to them at all
- now the input can at least be scrolled.
I think we can leave this threshold out of scope for this PR as it's a separate pre-existing edge, and changing it moves the flip point for every auto-grow input.
Happy to look at it separately though. The proper fix is to subtract the measuring padding from textInputHeight first, so both sides of the comparison are content heights.
| */ | ||
| getAutoGrowHeightInputStyle: (textInputHeight: number, maxHeight: number): ViewStyle => { | ||
| getAutoGrowHeightInputStyle: (textInputHeight: number, maxHeight: number, verticalInset: number): ViewStyle => { | ||
| if (textInputHeight > maxHeight) { |
There was a problem hiding this comment.
textInputHeight isn't the height of the text. It's the height of the hidden <Text> we measure with, and that one still carries baseTextInput's paddingTop: 15 / paddingBottom: 8 (the real input has them zeroed by pv0).
So it's 23 + lines × 20, which is the same scale as maxAutoGrowHeight - the container height is literally textInputHeight + 8.
verticalInset takes you out of that scale and into the input's own box, so subtracting it here compares two different things.
In practice it would flip one line too early.
At 4 lines textInputHeight is 103 and the container is 111 tall, so there's 82px of room for 80px of text - it fits fine, nothing needs to scroll.
But 103 > 115 - 29 is true, so we'd drop the fixed height and switch to overflow: auto anyway, which is the scrollbar flash the fixed height is there to prevent.
|
If we're going to fix it, let's fix it properly IMO. Can you try to implement the hidden sizing changes here? |
|
@chuckdries addressed |
|
🚧 chuckdries has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/chuckdries in version: 9.4.80-0 🚀
|
|
🤖 No help site changes are required. I did not create a docs PR. Why: this PR only corrects a pixel-height calculation inside a shared text input component. It adds That restores the behavior a user already expects. It does not change any feature, field, setting, tab, button, or workflow, and it adds no new copy. What I checked
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.80-0 🚀
Bundle Size Analysis (Sentry): |





Explanation of Change
getAutoGrowHeightInputStylegives anautoGrowHeightinput a fixed height andoverflow: hiddenwhile it is growing, then drops the fixed height and switches tooverflow: autoonce the content passesmaxAutoGrowHeight.The fixed height was 12px taller than the height the input actually gets after that flip - the formula subtracted the label padding and the borders, but not the container's own
padding: 8or itspb1:115 - inputPaddingTop (15) - borderWidth x 2 (2)= 98115 - borders (2) - padding (8) - pb1 (4) - label padding (15)= 86So a paste scrolls the caret into view against the stale 98px box, then the box shrinks to 86px and nothing re-scrolls - leaving the view 12px short of the end, constant regardless of how much was pasted.
This makes the two heights agree instead of correcting the offset afterwards. A new
StyleUtils.getAutoGrowHeightInputVerticalInsetreads the borders and padding off the flattened container style (sopt0/p0/pb1/ consumer overrides are honoured) andgetAutoGrowHeightInputStyleusesmaxHeight - verticalInset. BothBaseTextInputimplementations pass it from the container styles they already build.The 4-line maximum before the flip is 80px, still under 86, so the input still never scrolls while growing and no scrollbar flashes.
This is not a regression from #97489 - it is live in production on every non-markdown auto-grow input, so the fix also covers
CloseAccountPage,RejectExpenseReportPage,DynamicExitSurveyReasonPage,ReportsDefaultTitleandSamlConfigurationDetailsSectionContent.Fixed Issues
$ #99715
PROPOSAL: #99715 (comment)
Tests
Prerequisite: Copy several lines of text from a chat or document. (More than 5 lines)
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.mov
Android: mWeb Chrome
mchrome.mov
iOS: Native
ios.mov
iOS: mWeb Safari
msafari.mov
MacOS: Chrome / Safari
web.mov