Skip to content

[Due for payment 2025-06-09] [$250] Hybrid - iOS - FAB - Room name field is auto unfocused when switching from Chat to #Room #59388

Closed
react-navigation/react-navigation
#12563

Description

@IuliiaHerets

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.21-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No, reproducible on hybrid only
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): applausetester+260302kh@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: iPhone 15 Pro Max / iOS 18.3
App Component: Other

Action Performed:

  1. Launch hybrid app.
  2. Open FAB > Start chat.
  3. Make sure it opens Chat page, or else go to Chat, close it and repeat Step 2.
  4. Tap #Room.

Expected Result:

Room name field will remain focused.

Actual Result:

Room name field is auto unfocused and the field throws error "Please enter a room name".

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6787979_1743431804425.ScreenRecording_03-31-2025_22-32-51_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021906800718426819330
  • Upwork Job ID: 1906800718426819330
  • Last Price Increase: 2025-04-14
  • Automatic offers:
    • ikevin127 | Contributor | 106963135
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @maddylewis

Activity

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

    @melvin-bot

    Triggered auto assignment to @maddylewis (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. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 31, 2025
  4. changed the title [-]Hybrid - iOS - FAB - Room name field is auto unfocused when switching from Chat to #Room[/-] [+][$250] Hybrid - iOS - FAB - Room name field is auto unfocused when switching from Chat to #Room[/+] on Mar 31, 2025
  5. melvin-bot commented on Mar 31, 2025

    @melvin-bot
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 31, 2025
  7. melvin-bot commented on Mar 31, 2025

    @melvin-bot

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

  8. bernhardoj commented on Mar 31, 2025

    @bernhardoj
    Contributor

    Proposal

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

    The auto focus of the new room page is lost when switching tabs.

    What is the root cause of that problem?

    This kind of issue was previously fixed in #28646 where they introduced a 600ms delay when auto-focusing.
    image

    However, this PR #29203 maybe unintentionally change the delay to 300ms that is coming from useAutoFocusInput hook.

    focusTimeoutRef.current = setTimeout(() => {
    setIsScreenTransitionEnded(true);
    }, CONST.ANIMATED_TRANSITION);

    For context, we have this old issue that has the same issue. I have a proposal there and there is a deeper investigation about the issue.

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

    Have a new param to useAutoFocusInput called delay that has a default value of CONST.ANIMATED_TRANSITION. For the new room page, we will pass a custom 600ms delay.

    -const {inputCallbackRef} = useAutoFocusInput();
    +const {inputCallbackRef} = useAutoFocusInput(600);

    However, there is another logic to auto focus the input after the side pane transition ends, but it's triggered on the first mount too.

    // Trigger focus when side pane transition ends
    const {isSidePaneTransitionEnded, shouldHideSidePane} = useSidePane();
    useEffect(() => {
    if (!shouldHideSidePane) {
    return;
    }
    setIsScreenTransitionEnded(isSidePaneTransitionEnded);
    }, [isSidePaneTransitionEnded, shouldHideSidePane]);

    To fix it, we need to skip it if it's the initial mount (using a ref).

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

    N/A

  9. ntdiary commented on Apr 2, 2025

    @ntdiary
    Contributor

    Still under review, requires further investigation.

    I'm curious about the root cause of the input losing focus.

  10. melvin-bot commented on Apr 7, 2025

    @melvin-bot

    @ntdiary Huh... This is 4 days overdue. Who can take care of this?

  11. ntdiary commented on Apr 7, 2025

    @ntdiary
    Contributor
    Image

    I've figured out the root cause of the focus loss. The key sequence is

    1. User selects the #Room tab.
    2. Transition animation begins (i.e., setViewControllers:direction:animated:completion:)
    3. Our useAutoFocusInput hook assigns focus to the room name input field.
    4. Upon animation completion, iOS internally calls removeFromSuperview, which causes the input to lose focus.
    Image

    We can fix this by focusing only after animations complete (two approaches):

    1. as @bernhardoj's suggestion, increase the delay to 600ms.
    2. use the onPageSelected event, but right now, react-navigation doesn’t expose that event to the app.

    Personally, I think the second approach might be better. :)

  12. 64 remaining items

  13. melvin-bot commented on Jun 2, 2025

    @melvin-bot

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

  14. melvin-bot commented on Jun 2, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.54-7 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-06-09. 🎊

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

  15. melvin-bot commented on Jun 2, 2025

    @melvin-bot

    @ikevin127 / @getusha @maddylewis @ikevin127 / @getusha 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. ikevin127 commented on Jun 6, 2025

    @ikevin127
    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 specific offending PR, just logic implemented over time which wasn't working as expected on all platforms, therefore I labeled this as Result of the original design (eg. a case wasn't considered).

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

    1. Launch HybridApp.
    2. Open FAB > Start chat.
    3. Make sure it opens to Chat tab, otherwise switch to Chat, close and repeat step 2.
    4. Tap on the Room tab and verify that the input is focused and the focus is not lost shortly after.
    5. Tap back on the Chat tab and verify that the input is focused and the focus is not lost shortly after.

    Do we agree 👍 or 👎.

  17. ikevin127 commented on Jun 9, 2025

    @ikevin127
    Contributor

    @ikevin127 requires payment automatic offer (Contributor)

    @maddylewis Please discard this, I will be requesting payment through NewDot Manual Requests as well ✅

    A payment summary would help though 🙌

  18. maddylewis commented on Jun 9, 2025

    @maddylewis
    Contributor

    Payment Overview + Regression Test GH

    • @ikevin127 requires payment NewDot request - $250
    • @getusha requires payment through NewDot Manual Requests - $250
    • regression test GH
  19. JmillsExpensify commented on Jun 9, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @ikevin127

  20. garrettmknight commented on Jul 17, 2025

    @garrettmknight
    Contributor

    $250 approved for @getusha

  21. melvin-bot commented on Feb 20, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions