Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-12-05] [$125] Taxes - BNP input is not auto focused in add rate page #51543

Closed
2 of 8 tasks
lanitochka17 opened this issue Oct 27, 2024 · 42 comments
Closed
2 of 8 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 27, 2024

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.54-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5134453
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch New Expensify app
  2. Go to workspace settings > Taxes
  3. Tap Add rate
  4. Tap Value

Expected Result:

BNP input will be auto focused

Actual Result:

BNP input is not auto focused

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
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6647125_1730008681078.ScreenRecording_10-27-2024_13-52-22_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021850971328621900159
  • Upwork Job ID: 1850971328621900159
  • Last Price Increase: 2024-11-11
  • Automatic offers:
    • Krishna2323 | Contributor | 104920003
Issue OwnerCurrent Issue Owner: @garrettmknight
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Oct 27, 2024
Copy link

melvin-bot bot commented Oct 27, 2024

Triggered auto assignment to @thienlnam (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Oct 27, 2024

💬 A slack conversation has been started in #expensify-open-source

@lanitochka17
Copy link
Author

Production:

RPReplay_Final1730050554.MP4

@Krishna2323
Copy link
Contributor

Krishna2323 commented Oct 28, 2024

Edited by proposal-police: This proposal was edited at 2024-10-28 15:51:43 UTC.

Proposal


Please re-state the problem that we are trying to solve in this issue.

Taxes - BNP input is not auto focused in add rate page

What is the root cause of that problem?

  • I don't think this is caused by any recent PR.
  • We aren't focusing the input when the modal is visible.

<AmountForm
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
autoFocus
value={currentValue}
onInputChange={setValue}
/>

What changes do you think we should make in order to solve the problem?


  • To focus on the amount input whenever the modal is set to visible we should use the same method as we do in

    const inputRef = useRef<BaseTextInputRef | null>(null);
    const inputValueRef = useRef(value);
    const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null);
    const inputCallbackRef = (ref: BaseTextInputRef | null) => {
    inputRef.current = ref;
    };

    useFocusEffect(
    useCallback(() => {
    focusTimeoutRef.current = setTimeout(() => {
    if (inputRef.current && isVisible) {
    inputRef.current.focus();
    (inputRef.current as TextInputType).setSelection?.(inputValueRef.current?.length ?? 0, inputValueRef.current?.length ?? 0);
    }
    return () => {
    if (!focusTimeoutRef.current || !isVisible) {
    return;
    }
    clearTimeout(focusTimeoutRef.current);
    };
    }, CONST.ANIMATED_TRANSITION);
    }, [isVisible]),
    );

    <InputWrapper
    ref={inputCallbackRef}

  • We should add the following in AmountSelectorModal.

    // Store the ref of the input
    const inputRef = useRef<BaseTextInputRef | null>(null);
    const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null);

    const inputCallbackRef = (ref: BaseTextInputRef | null) => {
        inputRef.current = ref;
    };

    // use "useFocusEffect" focus on the input whenever "isVisible" state is changed.
    useFocusEffect(
        useCallback(() => {
            focusTimeoutRef.current = setTimeout(() => {
                if (inputRef.current && isVisible) {
                    inputRef.current.focus();
                }
                return () => {
                    if (!focusTimeoutRef.current || !isVisible) {
                        return;
                    }
                    clearTimeout(focusTimeoutRef.current);
                };
            }, CONST.ANIMATED_TRANSITION);
        }, [isVisible, inputRef]),
    );
    
    // Pass the ref to "AmountForm"
    ref={(ref) => inputCallbackRef(ref)}
  • We also need to remove the autoFocus prop.

What alternative solutions did you explore? (Optional)

Result

tax_amount_not_focused.mp4

@Beamanator
Copy link
Contributor

@Krishna2323

I don't think this is caused by any recent PR.

But then wouldn't that mean that the issue should be reproducible in prod?

@Beamanator Beamanator added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Oct 28, 2024
@Beamanator
Copy link
Contributor

I'm going to call this NAB - also I don't know if we need it to look "focused" - pressing numbers works fine

@Krishna2323
Copy link
Contributor

@Beamanator, I tried again to look for a recent PR that might have caused this issue, but I don’t believe any recent PR is responsible—though I may be wrong here. In my opinion, the root cause is the use of the autoFocus prop, which doesn’t always work. In all other components, we use inputCallbackRef from the useAutoFocusInput hook, and the same component is then focused correctly.

<InputWrapper
label={translate('iou.amount')}
InputComponent={AmountForm}
inputID={INPUT_IDS.MAX_EXPENSE_AMOUNT}
currency={CurrencyUtils.getCurrencySymbol(policy?.outputCurrency ?? CONST.CURRENCY.USD)}
defaultValue={defaultValue}
isCurrencyPressable={false}
ref={inputCallbackRef}

<InputWrapperWithRef
InputComponent={AmountForm}
inputID={INPUT_IDS.RATE}
fixedDecimals={CONST.MAX_TAX_RATE_DECIMAL_PLACES}
isCurrencyPressable={false}
currency={currency}
ref={inputCallbackRef}

I think we need to fix this to be consistent will all other similar pages:

Inconsistency

tax_amount_not_focused_issue.mp4

@thienlnam thienlnam added the External Added to denote the issue can be worked on by a contributor label Oct 28, 2024
@melvin-bot melvin-bot bot changed the title Taxes - BNP input is not auto focused in add rate page [$250] Taxes - BNP input is not auto focused in add rate page Oct 28, 2024
Copy link

melvin-bot bot commented Oct 28, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 28, 2024
Copy link

melvin-bot bot commented Oct 28, 2024

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

@thienlnam thienlnam changed the title [$250] Taxes - BNP input is not auto focused in add rate page [$125] Taxes - BNP input is not auto focused in add rate page Oct 28, 2024
Copy link

melvin-bot bot commented Oct 28, 2024

Upwork job price has been updated to $125

@Ollyws
Copy link
Contributor

Ollyws commented Nov 1, 2024

Reproducible, but also I agree with:

But then wouldn't that mean that the issue should be reproducible in prod?

What was the cause here?

Copy link

melvin-bot bot commented Nov 4, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Nov 4, 2024
Copy link

melvin-bot bot commented Nov 4, 2024

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

@thienlnam thienlnam added the Bug Something is broken. Auto assigns a BugZero manager. label Nov 5, 2024
Copy link

melvin-bot bot commented Nov 19, 2024

@garrettmknight, @Ollyws, @thienlnam, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@Krishna2323
Copy link
Contributor

@Ollyws, PR ready for review ^

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 28, 2024
@melvin-bot melvin-bot bot changed the title [$125] Taxes - BNP input is not auto focused in add rate page [HOLD for payment 2024-12-05] [$125] Taxes - BNP input is not auto focused in add rate page Nov 28, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 28, 2024
Copy link

melvin-bot bot commented Nov 28, 2024

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

Copy link

melvin-bot bot commented Nov 28, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.67-9 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 2024-12-05. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 28, 2024

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

@garrettmknight garrettmknight moved this from Bugs and Follow Up Issues to Hold for Payment in [#whatsnext] #expense Dec 3, 2024
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 5, 2024
@garrettmknight
Copy link
Contributor

@Ollyws please fill out the checklist

@garrettmknight
Copy link
Contributor

@Krishna2323 paid you out!

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
@garrettmknight
Copy link
Contributor

@Ollyws bump on the checklist

@melvin-bot melvin-bot bot removed the Overdue label Dec 9, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Dec 9, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other: Upstream bug.

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on both staging and production
  • 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: N/A

  • [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:

  • [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:

Test:

1. Go to workspace settings > Taxes
2. Tap Add rate
3. Tap Value
4. Verify the input is focused

Do we agree 👍 or 👎

@garrettmknight
Copy link
Contributor

Payment Summary:

@Ollyws go ahead and request.

@github-project-automation github-project-automation bot moved this from Hold for Payment to Done in [#whatsnext] #expense Dec 11, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Dec 11, 2024

Requested in ND.

@JmillsExpensify
Copy link

Confirming payment summary:

@garrettmknight
Copy link
Contributor

$125 approved for @Ollyws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

8 participants