Skip to content

[Due for payment 2025-04-03] [$250] Group - Closed keyboard opens again after adding a user to a group #57758

Closed

Description

@m-natarajan

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.8-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @alexpensify
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Tap on FAB
  2. Tap on "Start chat"
  3. Tap on the search input so the keyboard is opened
  4. Select a any user tapping on "Add to group"
  5. Verify the keyboard is not closed or reopened after selecting an user
  6. Close the keyboard by defocusing the input
  7. Select a member by tapping "Add to group"

Expected Result:

Keyboard is NOT opened again

Actual Result:

Keyboard opens again

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence
Keyboard.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021902286850403570448
  • Upwork Job ID: 1902286850403570448
  • Last Price Increase: 2025-03-19
Issue OwnerCurrent Issue Owner: @JmillsExpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @JmillsExpensify (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. daledah commented on Mar 4, 2025

    @daledah
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-03-04 15:13:50 UTC.

    Proposal

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

    Keyboard opens again

    What is the root cause of that problem?

    After selecting user, we focus input again

    selectionListRef.current?.focusTextInput();

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

    We should remove this line

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

    We have a test file here. Add new test to verify that input is not focus after select user
    https://github.com/Expensify/App/blob/main/tests/ui/NewChatPageTest.tsx

    What alternative solutions did you explore? (Optional)

    NA

    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. ryntgh commented on Mar 4, 2025

    @ryntgh
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-03-04 15:22:14 UTC.

    Proposal

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

    Group - Closed keyboard opens again after adding a user to a group

    What is the root cause of that problem?

    toggleOption function triggers a call to selectionListRef.current?.focusTextInput(), which forces the text input to gain focus and opens the keyboard.

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

    We can disable the call to focusTextInput() within the toggleOption function when the action is triggered by clicking "addToGroup."

    const toggleOption = useCallback(
        (option: ListItem & Partial<OptionData>, fromButton = false) => {
            const isOptionInList = !!option.isSelected;
    
            let newSelectedOptions;
    
            if (isOptionInList) {
                newSelectedOptions = reject(selectedOptions, (selectedOption) => selectedOption.login === option.login);
            } else {
                newSelectedOptions = [...selectedOptions, {...option, isSelected: true, selected: true, reportID: option.reportID ?? `${CONST.DEFAULT_NUMBER_ID}`}];
                selectionListRef?.current?.scrollToIndex(0, true);
            }
    
            // Only clear input and focus if not triggered from the addToGroup button
            if (!fromButton) {
                selectionListRef?.current?.clearInputAfterSelect?.();
                selectionListRef.current?.focusTextInput();
            }
            setSelectedOptions(newSelectedOptions);
        },
        [selectedOptions, setSelectedOptions],
    );
    <Button
        onPress={() => toggleOption(item, true)}
        style={[styles.pl2]}
        text={translate('newChatPage.addToGroup')}
        innerStyles={buttonInnerStyles}
        small
    />

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

    Make a test to verify that clicking the "addToGroup" button does not open the keyboard

    What alternative solutions did you explore? (Optional)

    None

  5. github-actions commented on Mar 4, 2025

    @github-actions
    Contributor

    ⚠️ Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

  6. bernhardoj commented on Mar 6, 2025

    @bernhardoj
    Contributor

    Coming from #29003 (comment)

    Proposal

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

    The keyboard shows again every time we add a user to the group selection.

    What is the root cause of that problem?

    This happens after #54994 where we always refocus the text input after adding a user to the group selection.

    selectionListRef.current?.focusTextInput();
    setSelectedOptions(newSelectedOptions);
    },
    [selectedOptions, setSelectedOptions],

    This was previously fixed in #33584 by not refocusing on touchscreen devices but this isn't working anymore since we are rendering a custom right component.

    shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()}

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

    We need to apply the same fix back to the custom right component.

    if (!canUseTouchScreen()) {
        selectionListRef.current?.focusTextInput();
    }
    

    Or we can use if (canFocusInputOnScreenFocus()).

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

    We can create a test and mock the canUseTouchScreen return value and assert that the input isn't focused when canUseTouchScreen is true, and vice versa, when adding a user to the group selection.

  7. melvin-bot commented on Mar 10, 2025

    @melvin-bot

    @JmillsExpensify Eep! 4 days overdue now. Issues have feelings too...

  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 12, 2025
  9. JmillsExpensify commented on Mar 12, 2025

    @JmillsExpensify
    Contributor

    Opened up for proposal review.

  10. 25 remaining items

  11. melvin-bot commented on Mar 27, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.19-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-04-03. 🎊

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

  12. melvin-bot commented on Mar 27, 2025

    @melvin-bot

    @allroundexperts @JmillsExpensify @allroundexperts 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]

  13. melvin-bot commented on Apr 3, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@JmillsExpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1902286850403570448/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  14. allroundexperts commented on Apr 3, 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: https://github.com/Expensify/App/pull/54994/files#r2026532178

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

    Precondition:

    • N/A

    Test:

    1. Open New chat page from FAB
    2. Blur the text input by pressing on anywhere or scroll the list
    3. Add to group any user

    Verify the input:
    a. is refocused on web/desktop
    b. not refocused on iOS/Android/mWeb

    Do we agree 👍 or 👎

  15. bernhardoj commented on Apr 3, 2025

    @bernhardoj
    Contributor

    Requested in ND.

  16. JmillsExpensify commented on Apr 7, 2025

    @JmillsExpensify
    Contributor

    Payment summary:

  17. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Apr 7, 2025
  18. garrettmknight commented on Apr 9, 2025

    @garrettmknight
    Contributor

    Payment summary:

    Contributor: @bernhardoj $250 via New Expensify
    Reviewer: @allroundexperts $250 via New Expensify

  19. JmillsExpensify commented on Apr 9, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

  20. JmillsExpensify commented on Jun 13, 2025

    @JmillsExpensify
    Contributor

    $250 approved 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 contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions