[HOLD for payment 2024-12-11] [$250] Web - Search - Text in search field does not move to the end by default to show text cursor
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.62-3 Reproducible in staging?: Y Reproducible in production?: Y 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): [email protected] Issue reported by: Applause - Internal Team
Action Performed:
- Go to staging.new.expensify.com
- Open a report with really long name (invoice chat with user that has email as display name).
- Click on the search icon on the top right.
- Click Search in.
Expected Result:
The text in the search field will move to the end to show the text cursor
Actual Result:
The text in the search field does not move to the end. The text cursor is hidden and user has to scroll to the right to see the text cursor
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Standalone
- [ ] Android: HybridApp
- [ ] Android: mWeb Chrome
- [ ] iOS: Standalone
- [ ] iOS: HybridApp
- [ ] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/6b21c058-3a96-46c0-8dec-658745d0b2c5
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021859033501841956761
- Upwork Job ID: 1859033501841956761
- Last Price Increase: 2024-11-20
- Automatic offers:
- daledah | Contributor | 105007725
Issue Owner
Current Issue Owner: @jliexpensify
Triggered auto assignment to @jliexpensify (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.
Proposal
Please re-state the problem that we are trying to solve in this issue.
- The text in the search field does not move to the end. The text cursor is hidden and user has to scroll to the right to see the text cursor
What is the root cause of that problem?
- We didn't have logic to scroll the input to the right in:
https://github.com/Expensify/App/blob/4cc54ab4e8ba32543c3895b07087d85e5e1d2831/src/components/Search/SearchRouter/SearchRouter.tsx#L328
What changes do you think we should make in order to solve the problem?
- We can introduce new util function:
const scrollToRight: ScrollToBottom = (input) => {
if (!('scrollLeft' in input)) {
return;
}
// Scroll to the far right
input.scrollLeft = input.scrollWidth; // Can use input.setSelectionRange(length, input.value.length) as well.
};
that will scroll to the far right.
- The above function has only one param, that is the ref of the input. To use it in this case, first we need to expose the ref of the SearchRouterInput by using
export default forwardRef(SearchRouterInput)instead of: https://github.com/Expensify/App/blob/4cc54ab4e8ba32543c3895b07087d85e5e1d2831/src/components/Search/SearchRouter/SearchRouterInput.tsx#L126 and then:
https://github.com/Expensify/App/blob/4cc54ab4e8ba32543c3895b07087d85e5e1d2831/src/components/Search/SearchRouter/SearchRouterInput.tsx#L83
will be:
<TextInput ref={ref} ...
- In here add:
const shouldScrollRef = useRef(false);
const searchRouterInputRef = useRef(null);
// Trigger scrollToRight when input value changes and shouldScroll is true
useEffect(() => {
if (shouldScrollRef.current) {
scrollToRight(searchRouterInputRef?.current);
shouldScrollRef.current = false;
}
}, [debouncedInputValue]);
This logic will call the scrollToRight only if shouldScrollRef.current is true because we only want to scrollToRight in a few cases.
- Then we update: https://github.com/Expensify/App/blob/4cc54ab4e8ba32543c3895b07087d85e5e1d2831/src/components/Search/SearchRouter/SearchRouter.tsx#L328-L329
const onSearchChange = useCallback(
(userQuery: string, autoScrollToRight = false) => {
if (autoScrollToRight) {
shouldScrollRef.current = true;
}
and in:
https://github.com/Expensify/App/blob/4cc54ab4e8ba32543c3895b07087d85e5e1d2831/src/components/Search/SearchRouter/SearchRouterList.tsx#L249
call updateSearchValue(`${searchQuery} `, true) instead.
What alternative solutions did you explore? (Optional)
@lanitochka17 can you clarify what you mean exactly by this:
Open a report with really long name
Are you saying that any report with a long report title will cause this issue? Do you have any idea of a character limit that will cause this issue?
Or are you referring to just long emails?
@jliexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
Waiting on @lanitochka17
@jliexpensify I think not only long emails but also reports.
@lanitochka17 can you retest on v64-0? I can't reproduce this one consistently
Issue is still reproduce
https://github.com/user-attachments/assets/a3d0ebcb-01e4-40b9-96b5-28676b99106c
Job added to Upwork: https://www.upwork.com/jobs/~021859033501841956761
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)
I think this is a #retain issue, since it deals with an annoyance for our current customers.
Looks like @daledah's proposal would work. But I want to confirm if we really want it to be fixed.
π π π C+ reviewed.
Triggered auto assignment to @dangrous, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Yeah I think this is worth fixing, especially since people keep reporting it ^ haha.
Go for it, @daledah!
π£ @daledah π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
@mananjadhav PR is ready.
Reviewing label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.70-9 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/52945
If no regressions arise, payment will be issued on 2024-12-11. :confetti_ball:
For reference, here are some details about the assignees on this issue:
- @mananjadhav requires payment through NewDot Manual Requests
- @daledah requires payment automatic offer (Contributor)
@mananjadhav @jliexpensify @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]
Payment Summary
- C: @daledah $250 (paid via Upworks)
- C+: @mananjadhav $250 (to be paid via ND)
BugZero Checklist:
- [x] [Contributor] Classify the bug:
Bug classification
Source of bug:
- [x] 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:
- [x] 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
- [x] 3d. QA
- [ ] 3z. Other:
-
[x] [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: NA. It's en edge case that is never considered.
-
[x] [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
-
[x] [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.
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:
- Have a report with a really long name.
Test:
- Open a report with really long name (invoice chat with user that has email as display name).
- Click on the search icon on the top right.
- Click Search in .... (report name)
- Verify that the cursor is moved to the end.
Do we agree π or π
Paid and job closed, @mananjadhav here is the payment summary.
$250 approved for @mananjadhav