Skip to content

[Due for payment 2025-07-14] [$250] Web/Safari - 2FA - The 2FA page with the 6-digit code requested is not fully displayed #64404

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.68-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
Device used: Mac 15.4.1/Safari
App Component: User Settings

Action Performed:

  1. Navigate to https://staging.new.expensify.com
  2. Navigate to Security > Two-factor authentication
  3. Click Copy
  4. Click Next

Expected Result:

The 2FA verifying page is fully displayed when enabling 2FA.

Actual Result:

The 2FA page with the 6-digit code requested is not fully displayed when enabling 2FA. The page appears after clicking any button. Sometimes the page is blank

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

Bug6863140_1750209548925.Recording__154__2_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021937157228038614428
  • Upwork Job ID: 1937157228038614428
  • Last Price Increase: 2025-06-23
  • Automatic offers:
    • thelullabyy | Contributor | 107825562
Issue OwnerCurrent Issue Owner: @isabelastisser

Activity

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

    @melvin-bot

    Triggered auto assignment to @isabelastisser (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. nabi-ebrahimi commented on Jun 18, 2025

    @nabi-ebrahimi

    Proposal

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

    Web/Safari - 2FA - The 2FA page with the 6-digit code requested is not fully displayed

    What is the root cause of that problem?

    Safari handles input focus poorly when:

    • The input is inside an absolutely positioned element (e.g., a fixed footer).

    <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>

    • The page includes a scrollable container such as a ScrollView.

    <ScrollView
    keyboardShouldPersistTaps="handled"
    contentContainerStyle={styles.flexGrow1}
    >
    <View style={[styles.ph5, styles.mt3]}>
    <Text>
    {translate('twoFactorAuth.scanCode')}
    <TextLink href={TROUBLESHOOTING_LINK}> {translate('twoFactorAuth.authenticatorApp')}</TextLink>.
    </Text>
    <View style={[styles.alignItemsCenter, styles.mt5]}>
    <QRCode
    url={buildAuthenticatorUrl()}
    logo={expensifyLogo}
    logoRatio={CONST.QR.EXPENSIFY_LOGO_SIZE_RATIO}
    logoMarginRatio={CONST.QR.EXPENSIFY_LOGO_MARGIN_RATIO}
    />
    </View>
    <Text style={styles.mt5}>{translate('twoFactorAuth.addKey')}</Text>
    <View style={[styles.mt11, styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween]}>
    {!!account?.twoFactorAuthSecretKey && <Text>{splitSecretInChunks(account?.twoFactorAuthSecretKey ?? '')}</Text>}
    <PressableWithDelayToggle
    text={translate('twoFactorAuth.copy')}
    textChecked={translate('common.copied')}
    tooltipText=""
    tooltipTextChecked=""
    icon={Expensicons.Copy}
    inline={false}
    onPress={() => Clipboard.setString(account?.twoFactorAuthSecretKey ?? '')}
    styles={[styles.button, styles.buttonMedium, styles.twoFactorAuthCopyCodeButton]}
    textStyles={[styles.buttonMediumText]}
    accessible={false}
    />
    </View>
    <Text style={styles.mt11}>{translate('twoFactorAuth.enterCode')}</Text>
    </View>
    </ScrollView>

    • An input is auto-focused immediately after navigation.

    autoFocus={autoFocus}

    In these cases, Safari tries to scroll the input into view but miscalculates the horizontal position, causing a phantom horizontal scroll and layout shift.

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

    We should avoid using autoFocus directly in JSX for Safari. Instead, detect Safari using the user agent and manually focus the input with a short delay to allow the layout to stabilize after navigation. This prevents Safari from performing its buggy scroll behavior.

    Example fix:

       const onFocus = () => {
            if (!shouldFocusLast.current) {
                return;
            }
    
            lastValue.current = TEXT_INPUT_EMPTY_STATE;
            setInputAndIndex(lastFocusedIndex.current);
        };
    
    
        useEffect(() => {
            if (!autoFocus) {
                return;
            }
            const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
            if (isSafari) {
                setTimeout(() => {
                    onFocus();
                    inputRef.current?.focus(); // innerRef from props
                }, 300); // give time for layout to settle
            } else {
                onFocus();
                inputRef.current?.focus();
            }
        }, []);

    and remove the autoFocus={autoFocus} and onFocus={onFocus} props from TextInput.

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

    None

    What alternative solutions did you explore? (Optional)

  4. twisterdotcom commented on Jun 18, 2025

    @twisterdotcom
    Contributor

    Following my advice here: #63663 (comment).

    This appears to be an exploitative bug, not one linked to a PR, regression test or customer report, so likely closing.

  5. twisterdotcom commented on Jun 19, 2025

    @twisterdotcom
    Contributor

    Hmm, this one is pretty bad actually right?

  6. melvin-bot commented on Jun 23, 2025

    @melvin-bot

    @isabelastisser Whoops! This issue is 2 days overdue. Let's get this updated quick!

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 23, 2025
  8. changed the title [-]Web/Safari - 2FA - The 2FA page with the 6-digit code requested is not fully displayed[/-] [+][$250] Web/Safari - 2FA - The 2FA page with the 6-digit code requested is not fully displayed[/+] on Jun 23, 2025
  9. 21 remaining items

  10. melvin-bot commented on Jul 7, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.76-5 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 2025-07-14. 🎊

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

  11. melvin-bot commented on Jul 7, 2025

    @melvin-bot

    @DylanDylann @isabelastisser The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  12. isabelastisser commented on Jul 16, 2025

    @isabelastisser
    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:

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

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

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

      Link to issue:

    Regression Test Proposal

    Precondition:

    Test:

    Do we agree 👍 or 👎

  13. isabelastisser commented on Jul 16, 2025

    @isabelastisser
    Contributor

    @DylanDylann, can you please complete the checklist? thanks!

  14. isabelastisser commented on Jul 16, 2025

    @isabelastisser
    Contributor

    Payment summary:

    @DylanDylann requires payment through NewDot Manual Requests $250 for C+ review
    @thelullabyy paid in Upwork automatic offer (Contributor)

  15. DylanDylann commented on Jul 16, 2025

    @DylanDylann
    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: This is a case wasn't considered while implementing the feature

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

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

    Regression Test Proposal

    Test:

    1. Navigate to Security > Two-factor authentication
    2. Click Copy
    3. Click Next
    4. Verify 2FA verifying page is fully displayed

    Do we agree 👍 or 👎

  16. isabelastisser commented on Jul 16, 2025

    @isabelastisser
    Contributor

    All set!

  17. JmillsExpensify commented on Oct 14, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @DylanDylann

  18. quinthar commented on Oct 16, 2025

    @quinthar
    Contributor

    $250 to @DylanDylann

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 contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions