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
[Due for payment 2025-04-14] [$250] Search - Pasting long text removes left padding & cursor focus is missing #58214
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: V9.1.11-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers):Slottwo1+ffggggfd@gmail.com Issue reported by: Applause Internal Team Device used: Redminote 10s android 13 App Component: Search
Additionally, if we want to address the cursor focus issue, we can use InputUtils.scrollToRight to scroll to the right whenever the cursor is at the end of the input text
Copied content is added to the text field only at the position where the cursor is currently located without automatically scrolling to the new cursor position.
What changes do you think we should make in order to solve the problem?
Add this logic to calculate current position of the cursor and auto scroll input that position.
requestAnimationFrame(() => {
const selection = window.getSelection();
if (selection && selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
const caretRect = range.getBoundingClientRect();
const inputRect = textInputHTMLElement.getBoundingClientRect();
// Calculate position need to scroll to
const scrollLeft = Math.max(0,
caretRect.left - inputRect.left + textInputHTMLElement.scrollLeft - textInputHTMLElement.clientWidth / 2
);
const scrollTop = Math.max(0,
caretRect.top - inputRect.top + textInputHTMLElement.scrollTop - textInputHTMLElement.clientHeight / 2
);
// Auto scroll to the position of cursor
textInputHTMLElement.scrollLeft = scrollLeft;
textInputHTMLElement.scrollTop = scrollTop;
}
});
This solution not only solve the problem of the paste action with Input Search on this screen but also in all other screen which use InputComponent
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
NA
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
changed the title [-]Search - Pasting long text removes left padding & cursor focus is missing[/-][+][$250] Search - Pasting long text removes left padding & cursor focus is missing[/+]on Mar 12, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.23-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@mananjadhav@isabelastisser@mananjadhav The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
@mananjadhav The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment:
@mananjadhav If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
@mananjadhav If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: Couldn't pinpoint an exact offending PR. This was a problem for all the inputs on a specific platform.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
I think it makes sense to add the regression test as it relates to a common component.
Regression Test Proposal
Test:
Open Ap
Tap the Search icon at the top
Paste a short text into the search input
Observe that the text has proper left padding, and the focus is on the cursor
Remove the text
Paste a long text into the search input
Verify the focusing cursor remains visible at the end of the pasted text and the left padding is consistent for both short and long pasted text.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Mar 11, 2025
Triggered auto assignment to @isabelastisser (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.nyomanjyotisa commentedon Mar 11, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-03-11 13:47:54 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Pasting long text removes left padding & cursor focus is missing
What is the root cause of that problem?
We apply
styles.pl3oninputStyleinstead oftextInputContainerStylesand don't apply any padding right on
textInputContainerStylesApp/src/components/Search/SearchAutocompleteInput.tsx
Lines 223 to 224 in 22fed8e
What changes do you think we should make in order to solve the problem?
Apply both padding left and right (padding horizontal) on
textInputContainerStylesand remove
styles.pl3frominputStyleAdditionally, if we want to address the cursor focus issue, we can use
InputUtils.scrollToRightto scroll to the right whenever the cursor is at the end of the input textand we should add
onSelectionChange={handleSelectionChange}to the text input as wellWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
New-Expensify.mp4
thelullabyy commentedon Mar 12, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Pasting short text maintains proper left padding and keeps focus on the cursor.
What is the root cause of that problem?
When text is pasted into the
InputComponent, thepastecallback fromuseHtmlPasteis executed.App/src/hooks/useHtmlPaste/index.ts
Lines 45 to 55 in 9b51ab8
Copied content is added to the text field only at the position where the cursor is currently located without automatically scrolling to the new cursor position.
What changes do you think we should make in order to solve the problem?
Add this logic to calculate current position of the cursor and auto scroll input that position.
This solution not only solve the problem of the paste action with Input Search on this screen but also in all other screen which use
InputComponentWith the left padding we've already have a PR here Text in search input, bounces with every letter added to the search to set opacity of the loading so we don't need add more padding and when we autoscroll with above logic, padding left will be correct
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
NA
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
melvin-bot commentedon Mar 12, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021899895633486475589
[-]Search - Pasting long text removes left padding & cursor focus is missing[/-][+][$250] Search - Pasting long text removes left padding & cursor focus is missing[/+]melvin-bot commentedon Mar 12, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)isabelastisser commentedon Mar 12, 2025
Hi @mananjadhav, can you please review the proposals above? Thanks!
mananjadhav commentedon Mar 13, 2025
I think we have similar solution of adding scrollToRight during the search. @nyomanjyotisa's proposal looks better to me.
🎀 👀 🎀 C+ reviewed
26 remaining items
melvin-bot commentedon Apr 7, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.23-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-04-14. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Apr 7, 2025
@mananjadhav @isabelastisser @mananjadhav The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
isabelastisser commentedon Apr 15, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
@mananjadhav The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment:
@mananjadhav If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
@mananjadhav If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
isabelastisser commentedon Apr 15, 2025
Payment summary:
@mananjadhav requires payment through NewDot Manual Request. $250 for C+ review
@thelullabyy paid in Upwork automatic offer (Contributor)$250 for proposal
isabelastisser commentedon Apr 15, 2025
@mananjadhav, please complete the BZ checklist. Thanks!
mananjadhav commentedon Apr 19, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: Couldn't pinpoint an exact offending PR. This was a problem for all the inputs on a specific platform.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
I think it makes sense to add the regression test as it relates to a common component.
Regression Test Proposal
Test:
Do we agree 👍 or 👎
@isabelastisser ^
garrettmknight commentedon Apr 22, 2025
$250 approved for @mananjadhav
isabelastisser commentedon Apr 22, 2025
All set!