App icon indicating copy to clipboard operation
App copied to clipboard

[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

Open lanitochka17 opened this issue 1 year ago β€’ 20 comments

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:

  1. Go to staging.new.expensify.com
  2. Open a report with really long name (invoice chat with user that has email as display name).
  3. Click on the search icon on the top right.
  4. 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

View all open jobs on GitHub

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 OwnerCurrent Issue Owner: @jliexpensify

lanitochka17 avatar Nov 14 '24 20:11 lanitochka17

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.

melvin-bot[bot] avatar Nov 14 '24 20:11 melvin-bot[bot]

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} ...
    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)

daledah avatar Nov 15 '24 01:11 daledah

@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 avatar Nov 15 '24 02:11 jliexpensify

@jliexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Nov 18 '24 09:11 melvin-bot[bot]

Waiting on @lanitochka17

jliexpensify avatar Nov 18 '24 09:11 jliexpensify

@jliexpensify I think not only long emails but also reports.

lanitochka17 avatar Nov 18 '24 17:11 lanitochka17

@lanitochka17 can you retest on v64-0? I can't reproduce this one consistently

jliexpensify avatar Nov 19 '24 05:11 jliexpensify

Issue is still reproduce

https://github.com/user-attachments/assets/a3d0ebcb-01e4-40b9-96b5-28676b99106c

lanitochka17 avatar Nov 19 '24 14:11 lanitochka17

Job added to Upwork: https://www.upwork.com/jobs/~021859033501841956761

melvin-bot[bot] avatar Nov 20 '24 00:11 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)

melvin-bot[bot] avatar Nov 20 '24 00:11 melvin-bot[bot]

I think this is a #retain issue, since it deals with an annoyance for our current customers.

jliexpensify avatar Nov 20 '24 00:11 jliexpensify

Looks like @daledah's proposal would work. But I want to confirm if we really want it to be fixed.

πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed.

mananjadhav avatar Nov 20 '24 19:11 mananjadhav

Triggered auto assignment to @dangrous, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Nov 20 '24 19:11 melvin-bot[bot]

Yeah I think this is worth fixing, especially since people keep reporting it ^ haha.

Go for it, @daledah!

dangrous avatar Nov 21 '24 15:11 dangrous

πŸ“£ @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 πŸ“–

melvin-bot[bot] avatar Nov 21 '24 15:11 melvin-bot[bot]

@mananjadhav PR is ready.

daledah avatar Nov 22 '24 07:11 daledah

Reviewing label has been removed, please complete the "BugZero Checklist".

melvin-bot[bot] avatar Dec 04 '24 01:12 melvin-bot[bot]

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)

melvin-bot[bot] avatar Dec 04 '24 01:12 melvin-bot[bot]

@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]

melvin-bot[bot] avatar Dec 04 '24 01:12 melvin-bot[bot]

Payment Summary

  • C: @daledah $250 (paid via Upworks)
  • C+: @mananjadhav $250 (to be paid via ND)

Upwork job

jliexpensify avatar Dec 08 '24 21:12 jliexpensify

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:

  1. Open a report with really long name (invoice chat with user that has email as display name).
  2. Click on the search icon on the top right.
  3. Click Search in .... (report name)
  4. Verify that the cursor is moved to the end.

Do we agree πŸ‘ or πŸ‘Ž

mananjadhav avatar Dec 10 '24 17:12 mananjadhav

Paid and job closed, @mananjadhav here is the payment summary.

jliexpensify avatar Dec 12 '24 02:12 jliexpensify

$250 approved for @mananjadhav

garrettmknight avatar Dec 12 '24 11:12 garrettmknight