Skip to content

[Due for payment 2025-08-13][$250] 2FA- 2FA verifying page is not fully displayed because keyboard open #65485

Closed

Description

@mitarachim

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: v9.1.76-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #65155
Email or phone of affected tester (no customers): gocemate+b2153624@gmail.com
Issue reported by: Applause Internal Team
Device used: Samsung Galaxy A02s/12
App Component: Other

Action Performed:

  1. Open the app
  2. Navigate to Security > Two-factor authentication
  3. Click Copy
  4. Click Next

Expected Result:

2FA verifying page should be fully displayed

Actual Result:

2FA verifying page is not fully displayed because keyboard open

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6877446_1751574981738.Recording__5688.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021942444293640322132
  • Upwork Job ID: 1942444293640322132
  • Last Price Increase: 2025-07-08
  • Automatic offers:
    • FitseTLT | Contributor | 108038345
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @RachCHopkins

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 4, 2025
  2. melvin-bot commented on Jul 4, 2025

    @melvin-bot

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

  3. ryntgh commented on Jul 4, 2025

    @ryntgh
    Contributor

    Proposal

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

    2FA- 2FA verifying page is not fully displayed because keyboard open

    What is the root cause of that problem?

    The ScreenWrapper in TwoFactorAuthWrapper is using the default keyboard avoiding behavior which causes the content to shift up when the keyboard appears

    <ScreenWrapper
    shouldShowOfflineIndicator={false}
    shouldEnableKeyboardAvoidingView={shouldEnableKeyboardAvoidingView}
    shouldEnableMaxHeight
    testID={stepName}
    >

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

    We should pass shouldEnableKeyboardAvoidingView={false} to the TwoFactorAuthWrapper like we did in other page like CopyCodesPage


    Additionally, we can move the TwoFactorAuthForm to the bottom of the enterCode text, so it does not stick to the footer with FixedFooter
    <View style={[styles.mh5, styles.mb4]}>
    <TwoFactorAuthForm innerRef={formRef} />
    </View>

    <Text style={styles.mt11}>{translate('twoFactorAuth.enterCode')}</Text>

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

    N/A

    What alternative solutions did you explore? (Optional)

  4. FitseTLT commented on Jul 4, 2025

    @FitseTLT
    Contributor

    Proposal

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

    2FA- 2FA verifying page is not fully displayed because keyboard open

    What is the root cause of that problem?

    1. We display the next button and input out of the scroll view which contains the other content in the page

      </ScrollView>
      <FixedFooter style={[styles.mt2, styles.pt2]}>
      <View style={[styles.mh5, styles.mb4]}>
      <TwoFactorAuthForm innerRef={formRef} />
      </View>
      <Button
      success
      large
      text={translate('common.next')}
      isLoading={account?.isLoading}
      onPress={() => {
      if (!formRef.current) {
      return;
      }
      formRef.current.validateAndSubmitForm();
      }}
      />
      </FixedFooter>

      so for small screens when the page opens the keyboard is open and because the content above the footer has it's own scroll view it will display only the begining part of the content and the last part of the content is accessed only if scrolled. This creates a weird experience and not consistent with other form pages in the App

    2. Moreover, the input is auto focused on mobile devices so the keyboard immediately opens on opening the page and the keyboard will take the space and make reading the above content difficult.

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

    1. The ScrollView should contain the FixedFooter too so that the whole content in the page is scrollable together and then we will need to apply flex1 to parent view here to put the footer always on bottom when the content is smaller than the screen height available
      <View style={[styles.ph5, styles.mt3]}>
                    <View style={[styles.ph5, styles.mt3, styles.flexGrow1]}>
    
    
    1. We should avoid auto focusing for small screen/mobiles so here
      useFocusEffect(
      useCallback(() => {
      if (!inputRef.current) {
      return;
     if (!inputRef.current || isSmallScreenWidth) {
                    return;
                }
    

    We can alternatively use other checks like canUseTouchScreen or canFocusInputOnScreenFocus to precisely identify their is an on-screen keyboard. Because we use TwoFactorAuthForm in different page if needed we can control the auto-focusing behavior with a new prop to apply it selectively.

    In addition to that, we have a bug in MagicCodeInput where the first box is highlighted without the text input getting focused because we always set the focusedIndex to 0 here so we should only set it to 0 if the autoFocus is true otherwise we should set it to undefined

    const [focusedIndex, setFocusedIndex] = useState<number | undefined>(0);

        const [focusedIndex, setFocusedIndex] = useState<number | undefined>(autoFocus ? 0 : undefined);
    
    

    Then we should set focusedIndex to the lastFocusedIndex here

    focusLastSelected() {
    inputRef.current?.focus();

                setFocusedIndex(lastFocusedIndex.current);
    
    

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

    N / A

    What alternative solutions did you explore? (Optional)

  5. mountiny commented on Jul 7, 2025

    @mountiny
    Contributor

    @thelullabyy @deetergp @DylanDylann Can you please follow up here as it seems to be related to this PR #65155

  6. DylanDylann commented on Jul 7, 2025

    @DylanDylann
    Contributor

    I still can reproduce this bug even after reverting #65155

    Screen_Recording_20250707_164922_Chrome.mp4
  7. melvin-bot commented on Jul 7, 2025

    @melvin-bot

    @RachCHopkins Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  8. RachCHopkins commented on Jul 7, 2025

    @RachCHopkins
    Contributor

    I don't think I understand this "bug" - how would you type in the code without the keyboard open?

    The page shows:

    1. QR code for scanning with authenticator app
    2. Secret key for adding to authenticator app manually
    3. Space to enter in the 6-digit code to confirm the authenticator app - for which the keyboard opens.

    If that's not the expected behaviour, what is? The OP here just says "FA verifying page should be fully displayed" - that's pretty loose and unhelpful IMO.

    I would expect the expected behaviour to be:

    1. The keyboard is hidden until the 6-digit code field is interacted with
    2. When the first code field is tapped into, the keyboard is shown

    In addition, the tester said that only "Android: mWeb Chrome" is affected. I have just tested it and see that is an issue on:

    • iOS app
    • iOS mWeb Safari - this one is hideous
    • Android app
    • Android mWeb Chrome

    The only mobile environment it works well is iOS mWeb Chrome, which works exactly as my "expected behaviour" outlined above.

    @DylanDylann this to me doesn't seem related to #64404 which appears to be specific to safari on mac.

  9. DylanDylann commented on Jul 8, 2025

    @DylanDylann
    Contributor

    @RachCHopkins It seems a good idea.

  10. truph01 commented on Jul 8, 2025

    @truph01
    Contributor

    Proposal

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

    2FA verifying page is not fully displayed because keyboard open

    What is the root cause of that problem?

    We want to change the behavior, the magic code input shouldn't be focused automatically

    Previously, we defaulted to using autoFocus on MagicCodeInput and then in #65155 we only change how to focus automatically from using autoFocus to using useFocusEffect to focus manually

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

    Because we don't want MagicCodeInput is focused automatically anymore

    We need to remove this useFocusEffect

    and this method

    We can discuss to consider doing the same behavior in other MagicCodeInput

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

    We can simulate the MagicCodeInput and verify that the input isn't focused automatically, and then simulate a press action on the input and verify that it focuses on the input

    What alternative solutions did you explore? (Optional)

  11. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 8, 2025
  12. 21 remaining items

  13. melvin-bot commented on Aug 7, 2025

    @melvin-bot

    This issue has not been updated in over 15 days. @dangrous, @allroundexperts, @RachCHopkins, @FitseTLT eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  14. FitseTLT commented on Aug 7, 2025

    @FitseTLT
    Contributor

    The PR went to production yesterday @RachCHopkins automation failed, so can you apply the appropriate labels? Thx

  15. changed the title [-][$250] 2FA- 2FA verifying page is not fully displayed because keyboard open[/-] [+][Due for payment 2025-08-13][$250] 2FA- 2FA verifying page is not fully displayed because keyboard open[/+] on Aug 13, 2025
  16. RachCHopkins commented on Aug 13, 2025

    @RachCHopkins
    Contributor

    @allroundexperts can we get a checklist please?

  17. allroundexperts commented on Aug 14, 2025

    @allroundexperts
    Contributor

    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:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 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: I wasn't able to pinpoint the exact PR that caused this.

    • [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: N/A

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

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/536574

    Regression Test Proposal

    Precondition:

    • N/A

    Test:

    1. Open the app
    2. Navigate to Security > Two-factor authentication
    3. Click Copy
    4. Click Next

    Verify that magic input is only auto-focused on Web/Desktop and not mobile.

    Do we agree 👍 or 👎

  18. RachCHopkins commented on Aug 15, 2025

    @RachCHopkins
    Contributor

    Payment Summary:

    Upwork job here

  19. RachCHopkins commented on Aug 15, 2025

    @RachCHopkins
    Contributor

    Contributor has been paid, the contract has been completed, and the Upwork post has been closed.

    🟢 for @allroundexperts to request payment via NewDot.

  20. trjExpensify commented on Jan 5, 2026

    @trjExpensify
    Contributor

    approved $250 for @allroundexperts.

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions