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

Bank account - App does not trigger required field validation when no state is selected #54572

Open
2 of 8 tasks
vincdargento opened this issue Dec 25, 2024 · 3 comments
Open
2 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@vincdargento
Copy link

vincdargento commented Dec 25, 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: v9.0.78-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
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): N/A
Issue reported by: Applause Internal Team

Action Performed:

  1. Open the app
  2. Open settings->workspaces->any workspace->workflows->connect bank account->connect manually
  3. Go to company information page and check each field shows error when we focus away without making a selection
  4. Open the state field
  5. Without making any selection go back

Expected Result:

App should trigger required field validation when we focus / open state field and focus away (as in PR #33926)

Actual Result:

App does not trigger required field validation when we focus / open state field and focus away.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

@vincdargento vincdargento added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 25, 2024
Copy link

melvin-bot bot commented Dec 25, 2024

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

@FitseTLT
Copy link
Contributor

FitseTLT commented Dec 25, 2024

Edited by proposal-police: This proposal was edited at 2024-12-25 18:59:32 UTC.

Proposal

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

Bank account - App does not trigger required field validation when no state is selected

What is the root cause of that problem?

We run validate onBlur but we are not bluring on modal close here

const handleModalClose = () => {
setIsModalVisible(false);
};
const handleModalOpen = () => {

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

We can apply similar fix as we did in here by blurring on modal close


    onBlur,
}: PushRowWithModalProps) {
    const [isModalVisible, setIsModalVisible] = useState(false);

    const handleModalClose = () => {
        onBlur?.();
        setIsModalVisible(false);
    };

we can also add a new prop of shouldBlurOnModalClose to make it optional and only call the blurring if true so that we can use it specifically for places we want.
BTW we can apply the same fix for StatePicker, CountryPicker and also other similar components where needed

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

@truph01
Copy link
Contributor

truph01 commented Dec 26, 2024

Proposal

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

  • App does not trigger required field validation when we focus / open state field and focus away.

What is the root cause of that problem?

  • In the bank account flow, we utilize the AddressFormFields component. Within this component, both the state picker and country picker rely on the PushRowWithModal component.

  • The PushRowWithModal was introduced in PR #51173. However, this implementation did not account for the bug we addressed in PR #33926. The root cause analysis (RCA) and corresponding solution for that issue are detailed here.

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

  • The general approach will align with PR #35926. Here's the detailed plan:

  • Introduce a new ref:

const shouldBlurOnCloseRef = useRef(true);

Add this in PushRowWithModal.

  • Update the modal close handler:

const handleModalClose = () => {
setIsModalVisible(false);
};

    const handleModalClose = () => {
        if (shouldBlurOnCloseRef.current) {
            onBlur?.(); // onBlur comes from PushRowWithModalProps
        }
        setIsModalVisible(false);
    };
  • Modify the modal open handler:

Add the following line at line:

        shouldBlurOnCloseRef.current = false;
  • Ensure backward compatibility:

Introduce a new flag parameter, such as shouldBlurInputOnCloseModal. Apply the above changes only when this flag is set to true. This will maintain backward compatibility for components relying on the existing behavior.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2
Projects
None yet
Development

No branches or pull requests

4 participants