Skip to content

[HOLD for payment 2023-09-12] [HOLD for payment 2023-09-11] [$500] Request money - Enter key does not move to next page on big number pad page #26588

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Issue found when executing PR #26520

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to + > Request money
  3. Enter an amount
  4. Hit Enter on the keyboard

Expected Result:

You can press enter on both, amount and Distance request page to continue to a next step

Actual Result:

Request money flow is not proceeded to the next page

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.62-1

Reproducible in staging?: Yes

Reproducible in production?: No

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Bug6186267_20230902_234752.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Activity

  1. OSBotify commented on Sep 2, 2023

    @OSBotify
    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.
  2. melvin-bot commented on Sep 2, 2023

    @melvin-bot

    Triggered auto assignment to @marcaaron (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

  3. melvin-bot commented on Sep 3, 2023

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  4. mkhutornyi commented on Sep 3, 2023

    @mkhutornyi
    Contributor

    Proposal

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

    Request money - Enter key does nothing on Manual request amount input page

    What is the root cause of that problem?

    This came from 5b8cd86 where pressOnEnter prop is added to DistanceRequest. cc: @hayata-suenaga

    Then why does this happen?
    We render all tabs on Request money page in the order of left > right.
    So Distance tab page is rendered after Manual tab page render.
    So Button's enter key is subscribed in MoneyRequestAmountForm first. And then DistanceRequest next.
    So when user press Enter key, DistanceRequest's button onPress takes precedence over MoneyRequestAmountForm's button.

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

    Step 1. set pressOnEnter prop value conditionally based on page active status.

    const isFocused = useIsFocused();
    <Button pressOnEnter={isFocused} />
    

    Step 2. Update Button component to dynamically subscribe/unsubscribe enter key listener based on pressOnEnter prop change.
    This logic will be added in componentDidUpdate

    What alternative solutions did you explore? (Optional)

    remove pressOnEnter prop from DistanceRequest's button

  5. napster125 commented on Sep 3, 2023

    @napster125
    Contributor

    Proposal

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

    Request money - Enter key does not move to next page on new money request page.

    What is the root cause of that problem?

    The root cause of this problem lies within the Button component, specifically in the way the Enter key listener is set up.

    componentDidMount() {
    if (!this.props.pressOnEnter) {
    return;
    }
    const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
    // Setup and attach keypress handler for pressing the button with Enter key
    this.unsubscribe = KeyboardShortcut.subscribe(
    shortcutConfig.shortcutKey,
    (e) => {
    if (!validateSubmitShortcut(this.props.isFocused, this.props.isDisabled, this.props.isLoading, e)) {
    return;
    }
    this.props.onPress();
    },
    shortcutConfig.descriptionKey,
    shortcutConfig.modifiers,
    true,
    false,
    this.props.enterKeyEventListenerPriority,
    false,
    );
    }

    Currently, this listener is only established during the componentDidMount lifecycle. This issue primarily occurs on the "New Request Money" page because the text field starts empty, causing the isDisabled property to be initially set to true, and subsequently to false as the user inputs data. However, the Button component does not respond to this change in isDisabled during the componentDidUpdate lifecycle, preventing the Enter key event from being properly handled.

    It's worth noting that this issue is observed in the development environment but is not likely a regression of commit, as the behavior of the Button component may be expected.

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

    To resolve this issue, I recommend adding the same logic for setting up the Enter key listener in the componentDidUpdate lifecycle when isDisabled changes. This modification ensures consistent behavior regardless of the initial state of isDisabled.

    componentDidMount() {
        this.setupEnterKeyListener();
    }
    componentDidUpdate(prevProps) {
        if (prevProps.isDisabled === this.props.isDisabled || this.props.isDisabled) {
            return;
        }
        this.setupEnterKeyListener();
    }
    componentWillUnmount() {
        // Cleanup event listeners
        if (!this.unsubscribe) {
            return;
        }
        this.unsubscribe();
    }
    

    What alternative solutions did you explore? (Optional)

    n/a

    Result

    6.mp4
  6. mountiny commented on Sep 3, 2023

    @mountiny
    Contributor

    @mkhutornyi I think your solution sounds good and I would prefer it over @napster125 proposed way as we dont want to mess with Button component logic right now give its such heavily used component.

    Can you describe how you gonna get the isActiveTab?

    remove pressOnEnter prop from DistanceRequest's button

    this will make it work for other pages, but then it does not work on the Distance request page.

  7. mountiny commented on Sep 3, 2023

    @mountiny
    Contributor

    I think I will just remove the pressOnEnter now because I am not sure if its trivial to get the tab index. I think we can live without the Enter working on the distance given it will be mainly used on mobile.

  8. napster125 commented on Sep 3, 2023

    @napster125
    Contributor

    @mountiny it's impossible because this line will prevent the enter key event when isDisabled is true.

    https://github.com/Expensify/App/blame/52b1e3e9abaabdaf79c0eeafef5665292cf2ab9c/src/components/Button/index.js#L178

  9. 73 remaining items

  10. parasharrajat commented on Sep 19, 2023

    @parasharrajat
    Member

    @mkhutornyi Reporting will be paid off when the issue is completely solved.

  11. dylanexpensify commented on Sep 22, 2023

    @dylanexpensify
    Contributor
  12. mountiny commented on Sep 25, 2023

    @mountiny
    Contributor

    I am confused whats he status on this one, can we close it out?

  13. b4s36t4 commented on Sep 25, 2023

    @b4s36t4
    Contributor

    @mountiny I think you can close this as there's another issue created for tracking the main issue. #28022

  14. mountiny commented on Sep 25, 2023

    @mountiny
    Contributor

    thanks! Feel free to reopen if closing is not the best path forwards

  15. parasharrajat commented on Oct 8, 2023

    @parasharrajat
    Member

    Payment requested as per #26588 (comment) #26588 (comment)

    @dylanexpensify Can you post the payment summary here? Thanks.

  16. dylanexpensify commented on Oct 9, 2023

    @dylanexpensify
    Contributor

    Payment summary:

  17. JmillsExpensify commented on Oct 9, 2023

    @JmillsExpensify
    Contributor

    $500 payment approved for @parasharrajat based on BZ summary.

  18. mkhutornyi commented on Oct 11, 2023

    @mkhutornyi
    Contributor

    Am I eligible for any compensation here? As my proposal (correct root cause and alternative solution) might have helped fixing this deploy blocker.


    Off topic:
    @parasharrajat gave 👎 on my main solution but unfortunately his solution of allowing bubble caused another regression - #29051, while mine wouldn't have caused.

  19. parasharrajat commented on Oct 11, 2023

    @parasharrajat
    Member

    @mkhutornyi You are eligible on #28022 as discussed before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions