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 2023-08-03] [$1000] Web - Input field is still in focus after error displayed for paypal.me #23031

Closed
1 of 6 tasks
kbecciv opened this issue Jul 17, 2023 · 29 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 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jul 17, 2023

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


Action Performed:

  1. Open the app
  2. Open settings
  3. Open payments
  4. If paypal.me is already added then edit or click on add payment method and select paypal.me
  5. Add any name with ';' in the end and click enter to trigger error (Only works when error is triggered on enter click )
  6. Observe that app display's error but focus is still kept on paypal.me field
  7. In similar manner, try to update room name field of any room with '&' in it to trigger error and observe that app loses focus from the field when error is displayed
  8. You can also try to add invalid contact method eg: 'Test;' and observe that it is similar to room name page

Expected Result:

App should either lose focus from paypal.me field on error or should focus on room name and contact method field on error to maintain consistency for similar single field forms

Actual Result:

App maintains focus on paypal.me field on error when form is submitted using enter but removes focus on room name and contact method field on error

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.41-2
Reproducible in staging?: y
Reproducible in production?: y
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

focus.inconsistency.on.single.input.forms.1.mp4
Recording.3702.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1689512318982939

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012f44624ab0fc235c
  • Upwork Job ID: 1681395339037409280
  • Last Price Increase: 2023-07-18
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

Triggered auto assignment to @maddylewis (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@ygshbht
Copy link
Contributor

ygshbht commented Jul 17, 2023

Proposal

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

The problem pertains to a lack of consistent user experience in the application related to input field behavior during error handling. Specifically, when an error is triggered on the Paypal.me input field (by entering a username ending with ";"), the focus remains on the field. In contrast, for other similar single field forms, such as when updating a room name or adding an invalid contact method, the application removes focus from the respective fields when an error is displayed.

What is the root cause of that problem?

The inconsistency arises from different structural code arrangements for handling form validations. In cases of adding a contact method or changing the room name, the application uses a Form component, which takes a validation prop and manages the focus behavior (i.e., blurring the input on error) internally. However, in the case of the AddPaypalMePage, a different structure is used that does not involve the Form component. The validation function for AddPaypalMePage does not contain logic to blur the input field upon encountering an error, thus causing the observed inconsistency.

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

A feasible solution is to introduce logic for blurring the input on error in the setPayPalMeData function, like so:

const setPayPalMeData = useCallback(() => {
    if (!ValidationUtils.isValidPaypalUsername(payPalMeUsername)) {
        payPalMeInput.current.blur(); // new addition
        setPayPalMeUsernameError(true);
        return;
    }
    setPayPalMeUsernameError(false);
    User.addPaypalMeAddress(payPalMeUsername);

    Growl.show(growlMessageOnSave, CONST.GROWL.SUCCESS, 3000);
    Navigation.navigate(ROUTES.SETTINGS_PAYMENTS);
}, [payPalMeUsername, growlMessageOnSave]);

This way, the Paypal.me field will lose focus whenever an error is encountered, aligning its behavior with other similar fields in the application, hence, ensuring a more consistent user experience.

@bernhardoj
Copy link
Contributor

bernhardoj commented Jul 18, 2023

Proposal

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

On the Paypal username page, pressing enter doesn't blur the text input.

What is the root cause of that problem?

Pressing enter on a text input by default will blur it. However, on the Paypal username page, we have a Button at the bottom that will override the enter listener.

<Button
success
onPress={setPayPalMeData}
pressOnEnter

On other pages, we use Form which has its own footer button that disables the behavior mentioned above, and use FormSubmit to handle the submit (enter) event instead.

disablePressOnEnter

App/src/components/Form.js

Lines 329 to 333 in 88b9416

<FormSubmit
ref={formContentRef}
style={StyleSheet.flatten([props.style, safeAreaPaddingBottomStyle])}
onSubmit={submit}
>

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

Migrate the page to use Form.

Some notable changes if migrating to Form:

  1. The footer button will always be enabled. Currently, the button is disabled if the input is empty.
  2. Refreshing the page won't auto-focus the input. This is a known issue.

What alternative solutions did you explore? (Optional)

Disable the press on enter on the button and wrap the page with FormSubmit instead to handle the enter.

@maddylewis maddylewis added the External Added to denote the issue can be worked on by a contributor label Jul 18, 2023
@melvin-bot melvin-bot bot changed the title Web - Input field is still in focus after error displayed for paypal.me [$1000] Web - Input field is still in focus after error displayed for paypal.me Jul 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 18, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 18, 2023

Current assignee @maddylewis is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 18, 2023

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

@maddylewis
Copy link
Contributor

added External label so C+ can start reviewing proposals.

@s-alves10
Copy link
Contributor

Proposal

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

Input filled is still focused after error occured in paypal.me page.

What is the root cause of that problem?

As @bernhardoj mentioned above, TextInput component will lose focus when enter key is pressed, but pressOnEnter on the button overrides this behavior

This is the root cause

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

We can simply add the blurring in setPayPalMeData callback.

        payPalMeInput.current.blur();

This works perfect.

What alternative solutions did you explore? (Optional)

@sobitneupane
Copy link
Contributor

Proposal from @bernhardoj looks good to me. I think we should take this opportunity to update the AddPayPalMePage to make use of Form.

Some notable changes if migrating to Form:

The footer button will always be enabled. Currently, the button is disabled if the input is empty.

I believe it's okay to have above change as we prefer consistency.

Refreshing the page won't auto-focus the input. This is a known #22850.

Let's keep following the #22850 issue. If any other measure is taken to solve the issue, we can do the same here.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

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

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

melvin-bot bot commented Jul 20, 2023

📣 @sobitneupane Please request via NewDot manual requests for the Reviewer role ($1000)

@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

📣 @bernhardoj You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Jul 20, 2023

📣 @dhanashree-sawant 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Upwork job

@bernhardoj
Copy link
Contributor

Missed this one. Will open the PR in a few hours

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jul 21, 2023
@bernhardoj
Copy link
Contributor

PR is ready

cc: @sobitneupane

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

🎯 ⚡️ Woah @sobitneupane / @bernhardoj, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @bernhardoj got assigned: 2023-07-20 19:53:33 Z
  • when the PR got merged: 2023-07-25 17:57:23 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 27, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Web - Input field is still in focus after error displayed for paypal.me [HOLD for payment 2023-08-03] [$1000] Web - Input field is still in focus after error displayed for paypal.me Jul 27, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

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

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

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:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane] 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:
  • [@sobitneupane] 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:
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] 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.
  • [@maddylewis] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@maddylewis maddylewis added Daily KSv2 and removed Weekly KSv2 labels Jul 29, 2023
@maddylewis
Copy link
Contributor

moving to daily since payments are due next week

@melvin-bot melvin-bot bot added the Overdue label Jul 31, 2023
@maddylewis
Copy link
Contributor

payment due on Aug 3

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Overdue Daily KSv2 labels Jul 31, 2023
@maddylewis
Copy link
Contributor

maddylewis commented Aug 6, 2023

Payments


  • Contributor hired on July 20
  • PR merged on July 25
  • PR merged in 3 biz days - eligible for bonus

@melvin-bot melvin-bot bot removed the Overdue label Aug 6, 2023
@maddylewis
Copy link
Contributor

@sobitneupane - will you confirm if the BZ checklist needs to be reviewed for this one? #23031 (comment)

@maddylewis
Copy link
Contributor

offer sent to @bernhardoj

@melvin-bot melvin-bot bot added the Overdue label Aug 8, 2023
@sobitneupane
Copy link
Contributor

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:

Rather than a bug, it was an inconsistency issue which was resolved by the use of FORM. So, checklist is not applicable for this issue..

@melvin-bot melvin-bot bot removed the Overdue label Aug 9, 2023
@sobitneupane
Copy link
Contributor

sobitneupane commented Aug 9, 2023

Regression Test Proposal

  1. Open Settings > Payments
  2. If you don't have PayPal added yet, press "Add payment method" and choose PayPal. If you have PayPal added, press the PayPal account and press Edit
  3. Verify the input is auto focused
  4. Type an invalid username, such as :, and enter
  5. Verify the input lost its focus and an error shows

Do we agree 👍 or 👎

@sobitneupane
Copy link
Contributor

Requested payment on newDot.

#23031 (comment)

@JmillsExpensify
Copy link

Reviewed payment details for @sobitneupane. $1.5k is approved for payment in NewDot.

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants