Skip to content

[Due for payment 2025-08-15] [$250] Try it out-"Scan our test receipt" tooltip appears in the wrong place when entering recipient #65702

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: 9.1.78
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #64988
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Device used: MacBook Air 15.5 Chrome
App Component: Other

Action Performed:

  1. Navigate to the staging.new.expensify.com, sign in with a brand new gmail account
  2. Click green "+" button - "Create expense"
  3. Verify that the "Scan our test receipt to see how it works" tooltip is displayed
  4. Click "Choose file" and upload a receipt
  5. Start typing an email address in the "Choose recipient" field

Expected Result:

"Scan our test receipt to see how it works" tooltip does not appear in the wrong place

Actual Result:

"Scan our test receipt to see how it works" tooltip appears in the wrong place when typing a recipient email

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

Bug6881940_1752013004292.Try_it_out.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021942969193363705065
  • Upwork Job ID: 1942969193363705065
  • Last Price Increase: 2025-07-23
  • Automatic offers:
    • nkdengineer | Contributor | 108205667
Issue OwnerCurrent Issue Owner: @lschurr

Activity

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

    @melvin-bot

    Triggered auto assignment to @lschurr (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. linhvovan29546 commented on Jul 9, 2025

    @linhvovan29546
    Contributor

    Proposal

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

    Try it out-"Scan our test receipt" tooltip appears in the wrong place when entering recipient

    What is the root cause of that problem?

    The IOURequestStartPage remains behind the choose receipt page. Since the tooltip display logic is in IOURequestStartPage, the tooltip continues to display even when the user is on the choose receipt page.

    const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip} = useProductTrainingContext(
    CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP,
    !getIsUserSubmittedExpenseOrScannedReceipt() && isBetaEnabled(CONST.BETAS.NEWDOT_MANAGER_MCTEST) && selectedTab === CONST.TAB_REQUEST.SCAN,

    Since the SCAN_TEST_TOOLTIP has a lower priority than SCAN_TEST_TOOLTIP_MANAGER, when SCAN_TEST_TOOLTIP_MANAGER is not displayed when search, SCAN_TEST_TOOLTIP will reappear.
    This happened after PR #61824, where we mistake removed the logic focused.

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

    We should only display the tooltip when the screen is focused.

    const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip} = useProductTrainingContext(
    CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP,
    !getIsUserSubmittedExpenseOrScannedReceipt() && isBetaEnabled(CONST.BETAS.NEWDOT_MANAGER_MCTEST) && selectedTab === CONST.TAB_REQUEST.SCAN,

        const isFocused = useIsFocused();
        const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip} = useProductTrainingContext(
            CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP,
         isFocused &&   !getIsUserSubmittedExpenseOrScannedReceipt() && isBetaEnabled(CONST.BETAS.NEWDOT_MANAGER_MCTEST) && selectedTab === CONST.TAB_REQUEST.SCAN,
            {
                onConfirm: () => {
                    setTestReceiptAndNavigateRef?.current?.();
                },
                onDismiss: () => {
                    dismissProductTraining(CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP, true);
                },
            },
        );

    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)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. nkdengineer commented on Jul 9, 2025

    @nkdengineer
    Contributor

    Proposal

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

    "Scan our test receipt to see how it works" tooltip appears in the wrong place when typing a recipient email

    What is the root cause of that problem?

    We have the logic to hide the tooltip when the page is blurred here.

    const unsubscribe = navigator.addListener('blur', () => {
    if (!shouldHideOnNavigate) {
    return;
    }
    genericTooltipStateRef.current?.hideTooltip();

    But when we open the participant page, the SCAN_TEST_TOOLTIP_MANAGER tooltip is shown, and because this tooltip has higher priority, shouldRender of SCAN_TEST_TOOLTIP is changed to false.

    const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip} = useProductTrainingContext(
    CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP,
    !getIsUserSubmittedExpenseOrScannedReceipt() && isBetaEnabled(CONST.BETAS.NEWDOT_MANAGER_MCTEST) && selectedTab === CONST.TAB_REQUEST.SCAN,

    When the user enters a user, the MC test participant is removed, and SCAN_TEST_TOOLTIP_MANAGER is hidden. It leads shouldRender of SCAN_TEST_TOOLTIP being changed to true, and the tooltip is shown based on this useEffect.

    useEffect(() => {
    if (!shouldMeasure) {
    return;
    }
    if (!shouldRender) {
    genericTooltipStateRef.current?.hideTooltip();
    return;
    }
    // When tooltip is used inside an animated view (e.g. popover), we need to wait for the animation to finish before measuring content.
    const timerID = setTimeout(() => {
    show.current?.();
    }, 500);
    return () => {
    clearTimeout(timerID);

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

    Instead of fixing it case by case, we can prevent this bug from occurring on other pages by fixing it on BaseEducationalTooltip. We can create a state to determine the focus state

    const [isFocused, setIsFocused] = useState(() => {
        return navigator?.isFocused?.() ?? true;
    });
    const unsubscribe = navigator.addListener('blur', () => {
        if (!shouldHideOnNavigate) {
            return;
        }
        setIsFocused(false);
        genericTooltipStateRef.current?.hideTooltip();
    });
    
    const unsubscribeFocus = navigator.addListener('focus', () => {
        setIsFocused(true);
    });
    return () => {
        unsubscribe();
        unsubscribeFocus();
    };
    

    const unsubscribe = navigator.addListener('blur', () => {
    if (!shouldHideOnNavigate) {
    return;
    }
    genericTooltipStateRef.current?.hideTooltip();

    Then we will prevent showing the tooltip if isFocused is false

    if (!shouldMeasure || !isFocused) {
        return;
    }
    

    if (!tooltipElementRef.current || !genericTooltipStateRef.current || !isFocused) {
        return;
    }
    

    const renderTooltip = useCallback(() => {

    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)

    Define a new config shouldShowOnBlur with the default value is false

    const useProductTrainingContext = (tooltipName: ProductTrainingTooltipName, shouldShow = true, config: ProductTrainingContextConfig = {}) => {

    And update the shouldShowProductTrainingTooltip condition here

    const shouldShowProductTrainingTooltip = useMemo(() => {
        return shouldShow && shouldRenderTooltip(tooltipName) && !shouldHideToolTip && (shouldShowOnBlur || isFocused);
    }, [shouldRenderTooltip, tooltipName, shouldShow, shouldHideToolTip, shouldShowOnBlur, isFocused]);
    

    const shouldShowProductTrainingTooltip = useMemo(() => {

    Then for all places that we use shouldHideOnNavigate={false} we will pass shouldShowOnBlur as true to useProductTrainingContext

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 9, 2025
  6. changed the title [-]Try it out-"Scan our test receipt" tooltip appears in the wrong place when entering recipient[/-] [+][$250] Try it out-"Scan our test receipt" tooltip appears in the wrong place when entering recipient[/+] on Jul 9, 2025
  7. melvin-bot commented on Jul 9, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 9, 2025
  9. melvin-bot commented on Jul 9, 2025

    @melvin-bot

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

  10. hoangzinh commented on Jul 14, 2025

    @hoangzinh
    Contributor

    Thank you, everyone, for posting proposals. I will review them soon.

  11. hoangzinh commented on Jul 15, 2025

    @hoangzinh
    Contributor

    Hi @nkdengineer, I tried to test proposal and it seems it doesn't work as expected.

    Screen.Recording.2025-07-15.at.20.39.59.mov
  12. linhvovan29546 commented on Jul 15, 2025

    @linhvovan29546
    Contributor

    @hoangzinh any thoughts on my proposal?
    I don’t think using isFocused inside BaseEducationalTooltip is correct, because we have a priority logic in tooltip. With that approach, if the current screen’s tooltip has a lower priority than the previous screen’s, the tooltip will not be displayed.

    And if we use that logic inside useProductTrainingContext, I have concerns about potential performance and regression issues, since useProductTrainingContext is also used within many place.

    correct me if I'm wrong

  13. 44 remaining items

  14. melvin-bot commented on Aug 8, 2025

    @melvin-bot

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

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

  15. melvin-bot commented on Aug 8, 2025

    @melvin-bot

    @hoangzinh @lschurr 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]

  16. lschurr commented on Aug 18, 2025

    @lschurr
    Contributor

    @hoangzinh Could you complete the checklist here?

  17. lschurr commented on Aug 18, 2025

    @lschurr
    Contributor

    Payment Summary

    Contributor: @nkdengineer paid $250 via Upwork
    Contributor+: @hoangzinh due $250 via NewDot

  18. hoangzinh commented on Aug 18, 2025

    @hoangzinh
    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: No offending PR. It's a case we haven't covered yet.

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

    Regression Test Proposal

    Test:

    1. Sign in with a new account
    2. Complete the onboarding flow
    3. Go FAB > Create Expense > Scan
    4. Verify that the "Scan our test receipt to see how it works" tooltip is displayed
    5. Click "Choose file" and upload a receipt
    6. Start typing an email address in the "Choose recipient" field
    7. Verify that the "Scan our test receipt to see how it works" tooltip isn't displayed

    Do we agree 👍 or 👎

  19. hoangzinh commented on Aug 18, 2025

    @hoangzinh
    Contributor

    Thanks @lschurr. I requested in ND

  20. twisterdotcom commented on Aug 19, 2025

    @twisterdotcom
    Contributor

    @hoangzinh has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-139a-a64a-8425-77d89027c751
  21. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Aug 20, 2025
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