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-08-09] [$250] Expensify Card - Hitting Enter on limit amount page does not proceed to the next page #45269

Closed
6 tasks done
lanitochka17 opened this issue Jul 11, 2024 · 35 comments
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 Jul 11, 2024

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


Version Number: 9.0.6-1
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Expensify Card (enable in More features)
  3. Click Issue new card
  4. Proceed to Step 4 - Set a limit
  5. Enter an amount, then hit Enter (keyboard)

Expected Result:

Hitting Enter on limit amount page will proceed to the next page

Actual Result:

Hitting Enter on limit amount page does not proceed to the next page

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6538919_1720701047945.20240711_202859.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0131bf3ff1bba82181
  • Upwork Job ID: 1812597871244092170
  • Last Price Increase: 2024-07-21
  • Automatic offers:
    • rayane-djouah | Reviewer | 103253113
    • nyomanjyotisa | Contributor | 103253115
Issue OwnerCurrent Issue Owner: @adelekennedy
@lanitochka17 lanitochka17 added DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels Jul 11, 2024
Copy link

melvin-bot bot commented Jul 11, 2024

Triggered auto assignment to @srikarparsi (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.

@lanitochka17
Copy link
Author

@srikarparsi FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 2

@nyomanjyotisa
Copy link
Contributor

nyomanjyotisa commented Jul 11, 2024

Proposal

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

Hitting Enter on limit amount page does not proceed to the next page

What is the root cause of that problem?

Default disablePressOnEnter here is true

disablePressOnEnter = true,

We don't set disablePressOnEnter on FormProvider here

<FormProvider
formID={ONYXKEYS.FORMS.ISSUE_NEW_EXPENSIFY_CARD_FORM}
// TODO: change the submitButtonText to 'common.confirm' when editing and navigate to ConfirmationStep
submitButtonText={translate('common.next')}
onSubmit={submit}
style={[styles.flex1]}
submitButtonStyles={[styles.mh5, styles.mt0]}
submitFlexEnabled={false}
enabledWhenOffline
validate={validate}
>

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

Add disablePressOnEnter={false} on <FormProvider> here

What alternative solutions did you explore? (Optional)

@nkdengineer
Copy link
Contributor

Proposal

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

Hitting Enter on limit amount page does not proceed to the next page

What is the root cause of that problem?

We don't pass disablePressOnEnter={false} into FormProvider as in other pages like RatePage, WorkspaceNewRoomPage, ...

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

Pass disablePressOnEnter={false} into FormProvider here

What alternative solutions did you explore? (Optional)

@nyomanjyotisa
Copy link
Contributor

Proposal updated

@Julesssss Julesssss added Daily KSv2 Hourly KSv2 and removed Hourly KSv2 DeployBlockerCash This issue or pull request should block deployment Daily KSv2 DeployBlocker Indicates it should block deploying the API labels Jul 11, 2024
@Julesssss
Copy link
Contributor

Not a blocker, this is a minor problem.

@srikarparsi srikarparsi added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. and removed Hourly KSv2 labels Jul 11, 2024
Copy link

melvin-bot bot commented Jul 11, 2024

Triggered auto assignment to @adelekennedy (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.

@srikarparsi
Copy link
Contributor

Hi @adelekennedy! Do you know if it's expected that pressing enter takes you to the next screen? I'm not sure if this is something we want to fix. I can also check in product.

@bernhardoj
Copy link
Contributor

Proposal

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

Pressing Enter doesn't proceed the user to the next page in the limit amount page.

What is the root cause of that problem?

The limit amount page is wrapped with a FormProvider. In FormProvider, if we press enter on an input, it will trigger onSubmitEditing and submit the form, but we will only handle it if shouldSubmitForm is true.

...(shouldSubmitForm && {
onSubmitEditing: (event: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => {
submit();
inputProps.onSubmitEditing?.(event);
},
returnKeyType: 'go',
}),

shouldSubmitForm is calculated inside InputWrapper.

if (textInputBasedComponents.includes(InputComponent)) {
const isEffectivelyMultiline = !!multiline || !!autoGrowHeight;
// If the user can use the hardware keyboard, they have access to an alternative way of inserting a new line
// (like a Shift+Enter keyboard shortcut). For simplicity, we assume that when there's no touch screen, it's a
// desktop setup with a keyboard.
const canUseHardwareKeyboard = !canUseTouchScreen();
// We want to avoid a situation when the user can't insert a new line. For single-line inputs, it's not a problem and we
// force-enable form submission. For multi-line inputs, ensure that it was requested to enable form submission for this specific
// input and that alternative ways exist to add a new line.
const shouldReallySubmitForm = isEffectivelyMultiline ? !!shouldSubmitForm && canUseHardwareKeyboard : true;
return {
// There are inputs that don't have onBlur methods, to simulate the behavior of onBlur in e.g. checkbox, we had to
// use different methods like onPress. This introduced a problem that inputs that have the onBlur method were
// calling some methods too early or twice, so we had to add this check to prevent that side effect.
// For now this side effect happened only in `TextInput` components.
shouldSetTouchedOnBlurOnly: true,
blurOnSubmit: (isEffectivelyMultiline && shouldReallySubmitForm) || blurOnSubmit,
shouldSubmitForm: shouldReallySubmitForm,
};
}
return {
shouldSetTouchedOnBlurOnly: false,
// Forward the originally provided value
blurOnSubmit,
shouldSubmitForm: !!shouldSubmitForm,
};
}

If the InputComponent is included in textInputBasedComponents, then we always return shouldSubmitForm as true for a single line. Otherwise, the shouldSubmitForm value will rely on the props that we pass, and there is no default value for it, which means it will be false.

For the limit amount page, the input that we use is AmountForm, which isn't included in textInputBasedComponents,

const textInputBasedComponents: TextInputBasedComponents = [TextInput, RoomNameInput];

and we don't set the shouldSubmitForm prop to the AmountForm,

<InputWrapper
InputComponent={AmountForm}
defaultValue={CurrencyUtils.convertToFrontendAmountAsString(issueNewCard?.data?.limit, CONST.CURRENCY.USD, false)}
isCurrencyPressable={false}
inputID={INPUT_IDS.LIMIT}
ref={inputCallbackRef}
/>

that's why pressing Enter does nothing compared to other pages, such as new task.

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

We have 2 options. Add AmountForm to textInputBasedComponents (preferrable),

const textInputBasedComponents: TextInputBasedComponents = [TextInput, RoomNameInput];

or pass shouldSubmitForm as true for AmountForm input wrapper.

<InputWrapper
InputComponent={AmountForm}
defaultValue={CurrencyUtils.convertToFrontendAmountAsString(issueNewCard?.data?.limit, CONST.CURRENCY.USD, false)}
isCurrencyPressable={false}
inputID={INPUT_IDS.LIMIT}
ref={inputCallbackRef}
/>

@srikarparsi
Copy link
Contributor

It does looking like pressing enter to go to the next page works everywhere else so let's get this fixed. Making this external to pick a proposal.

@srikarparsi srikarparsi added the External Added to denote the issue can be worked on by a contributor label Jul 14, 2024
@melvin-bot melvin-bot bot changed the title Expensify Card - Hitting Enter on limit amount page does not proceed to the next page [$250] Expensify Card - Hitting Enter on limit amount page does not proceed to the next page Jul 14, 2024
Copy link

melvin-bot bot commented Jul 24, 2024

@srikarparsi, @adelekennedy, @rayane-djouah Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@rayane-djouah
Copy link
Contributor

friendly bump @srikarparsi ^^

@srikarparsi
Copy link
Contributor

This sounds good to me

@melvin-bot melvin-bot bot removed the Overdue label Jul 24, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 24, 2024
Copy link

melvin-bot bot commented Jul 24, 2024

📣 @rayane-djouah 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jul 24, 2024

📣 @nyomanjyotisa 🎉 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 melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jul 25, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 2, 2024
@melvin-bot melvin-bot bot changed the title [$250] Expensify Card - Hitting Enter on limit amount page does not proceed to the next page [HOLD for payment 2024-08-09] [$250] Expensify Card - Hitting Enter on limit amount page does not proceed to the next page Aug 2, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

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

Copy link

melvin-bot bot commented Aug 2, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.15-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-08-09. 🎊

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

Copy link

melvin-bot bot commented Aug 2, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@rayane-djouah] The PR that introduced the bug has been identified. Link to the PR:
  • [@rayane-djouah] 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:
  • [@rayane-djouah] A discussion in #expensify-bugs 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:
  • [@rayane-djouah] Determine if we should create a regression test for this bug.
  • [@rayane-djouah] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@adelekennedy] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 8, 2024
@adelekennedy
Copy link

Payments made! @rayane-djouah just the checklist here!

@rayane-djouah
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: [No QA] Card flow screens #44376
  • 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: https://github.com/Expensify/App/pull/44376/files#r1712720155
  • A discussion in #expensify-bugs 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: N/A
  • Determine if we should create a regression test for this bug. Yes
  • If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Regression Test Proposal

  • General regression test steps for forms:
  1. Open the app.
  2. Navigate to any page that contains a form.
  3. Focus on a non-multiline input field and enter text.
  4. Press the Enter key on the keyboard.
  5. Verify that pressing the enter key submits the form.
  • Regression test steps specific to this bug (The form on limit amount page):
  1. Go to workspace settings > Expensify Card (enable in More features).
  2. Click Issue new card.
  3. Proceed to Step 4 - Set a limit.
  4. Enter an amount, then press the Enter key on the keyboard.
  5. Verify that hitting Enter on limit amount page will proceed to the next page.

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Aug 12, 2024
@adelekennedy
Copy link

makes sense to me! @srikarparsi any additional thoughts on the steps above?

@melvin-bot melvin-bot bot removed the Overdue label Aug 12, 2024
@srikarparsi
Copy link
Contributor

srikarparsi commented Aug 13, 2024

Nope, the steps look good to me as well!

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
None yet
Development

No branches or pull requests

8 participants