Skip to content

[HOLD for payment 2023-10-12] [$500] Web - Members page search bar does not get focused after removing and inviting a member #26955

Closed

Description

@kbecciv

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Login to staging new dot
  2. Go to workspaces and select members
  3. Select a few members and click on remove
  4. Observe that the search bar does not regain its focus after members are removed
    Case II
  5. Login to staging new dot
  6. Go to workspaces and select members
    3, Click on invite and select a few accounts and click on next and click on invite
  7. Observe that the search bar in members page loses its focus

Expected Result:

Search bar should be focused

Actual Result:

search bar loses focus

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.65.2
Reproducible in staging?: y
Reproducible in production?: y
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
Notes/Photos/Videos: Any additional supporting documentation

Screen_Recording_20230907_082908_Chrome.mp4
2023_09_03_07_45_35.mp4

Expensify/Expensify Issue URL:
Issue reported by: @SofoniasN
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693716569986309

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01cd4466f923f82031
  • Upwork Job ID: 1701308557266300928
  • Last Price Increase: 2023-09-18
  • Automatic offers:
    • jjcoffee | Reviewer | 26825119
    • dukenv0307 | Contributor | 26825121
    • sofoniasN | Reporter | 26825122

Activity

  1. added
    Daily
    Bug
    on Sep 7, 2023
  2. melvin-bot commented on Sep 7, 2023

    @melvin-bot

    Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. melvin-bot commented on Sep 7, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  4. dukenv0307 commented on Sep 7, 2023

    @dukenv0307
    Contributor

    Proposal

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

    Members page search bar does not get focused after removing and inviting a member

    What is the root cause of that problem?

    When selecting an option, we don't re-focus the TextInput same as OptionSelector

    const selectRow = (item, index) => {
    // In single-selection lists we don't care about updating the focused index, because the list is closed after selecting an item
    if (canSelectMultiple) {
    if (sections.length === 1) {
    // If the list has only 1 section (e.g. Workspace Members list), we always focus the next available item
    const nextAvailableIndex = _.findIndex(flattenedSections.allOptions, (option, i) => i > index && !option.isDisabled);
    setFocusedIndex(nextAvailableIndex);
    } else {
    // If the list has multiple sections (e.g. Workspace Invite list), we focus the first one after all the selected (selected items are always at the top)
    const selectedOptionsCount = item.isSelected ? flattenedSections.selectedOptions.length - 1 : flattenedSections.selectedOptions.length + 1;
    setFocusedIndex(selectedOptionsCount);

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

    In selectRow function, we should re-focus the textInput when we select an option

    textInputRef.current.focus();
    

    const selectRow = (item, index) => {
    // In single-selection lists we don't care about updating the focused index, because the list is closed after selecting an item
    if (canSelectMultiple) {
    if (sections.length === 1) {
    // If the list has only 1 section (e.g. Workspace Members list), we always focus the next available item
    const nextAvailableIndex = _.findIndex(flattenedSections.allOptions, (option, i) => i > index && !option.isDisabled);
    setFocusedIndex(nextAvailableIndex);
    } else {
    // If the list has multiple sections (e.g. Workspace Invite list), we focus the first one after all the selected (selected items are always at the top)
    const selectedOptionsCount = item.isSelected ? flattenedSections.selectedOptions.length - 1 : flattenedSections.selectedOptions.length + 1;
    setFocusedIndex(selectedOptionsCount);

    What alternative solutions did you explore? (Optional)

    If we only want to re-focus the TextInput for some special pages we can add an extra prop in BaseSelectionList like shouldFocusOnSelect. And then if it's true, we will re-focus on selectRow function.

    If (shouldFocusOnSelect) {
        textInputRef.current.focus();
    }
    
  5. namhihi237 commented on Sep 7, 2023

    @namhihi237
    Contributor

    Proposal

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

    • The Input search auto-focused when back to the page
    • Search input auto-focus when selecting a row

    What is the root cause of that problem?

    We have 2 cases in here

    1. We do not re-focus when select the row here

      const selectRow = (item, index) => {

    2. The search bar does not focus after the invite
      In this case, the same goes to the next page and back
      In a WorkspaceMembersPage and WorkspaceInvitePage we use SelectionList.
      And in BaseSelectionList we just have a logical focus when the component mounts, but when we go to the other page and then go back, the previous page won't unmount which is why the input is not re-focused.

      focusTimeoutRef.current = setTimeout(() => textInputRef.current.focus(), CONST.ANIMATED_TRANSITION);

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

    1. We should focus when select a row in function selectRow
    textInputRef.current.focus();
    1. We should add the logic to focus the input when the page is visible again in BaseSelectionList
        useEffect(() => {
            if (shouldShowTextInput && isFocused && !prevIsFocused) {
                if (shouldDelayFocus) {
                    focusTimeoutRef.current = setTimeout(() => textInputRef.current.focus(), CONST.ANIMATED_TRANSITION);
                } else {
                    textInputRef.current.focus();
                }
            }
        }, [isFocused, prevIsFocused, shouldShowTextInput, shouldDelayFocus])

    What alternative solutions did you explore? (Optional)

    N/A

  6. melvin-bot commented on Sep 11, 2023

    @melvin-bot

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

  7. melvin-bot commented on Sep 11, 2023

    @melvin-bot

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

  8. added
    External
    on Sep 11, 2023
  9. changed the title [-]Web - Members page search bar does not get focused after removing and inviting a member[/-] [+][$500] Web - Members page search bar does not get focused after removing and inviting a member[/+] on Sep 11, 2023
  10. melvin-bot commented on Sep 11, 2023

    @melvin-bot
  11. added
    Help Wanted
    on Sep 11, 2023
  12. melvin-bot commented on Sep 11, 2023

    @melvin-bot

    Current assignee @sakluger is eligible for the External assigner, not assigning anyone new.

  13. 31 remaining items

  14. changed the title [-][$500] Web - Members page search bar does not get focused after removing and inviting a member[/-] [+][HOLD for payment 2023-10-12] [$500] Web - Members page search bar does not get focused after removing and inviting a member[/+] on Oct 5, 2023
  15. removed
    Reviewing
    on Oct 5, 2023
  16. melvin-bot commented on Oct 5, 2023

    @melvin-bot

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

  17. melvin-bot commented on Oct 5, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.77-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 2023-10-12. 🎊

    After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

    • External issue reporter
    • Contributor that fixed the issue
    • Contributor+ that helped on the issue and/or PR

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

    As a reminder, here are the bonuses/penalties that should be applied for any External issue:

    • Merged PR within 3 business days of assignment - 50% bonus
    • Merged PR more than 9 business days after assignment - 50% penalty
  18. melvin-bot commented on Oct 5, 2023

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@jjcoffee] The PR that introduced the bug has been identified. Link to the PR:
    • [@jjcoffee] 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:
    • [@jjcoffee] A discussion in #expensify-bugs 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:
    • [@jjcoffee] Determine if we should create a regression test for this bug.
    • [@jjcoffee] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@sakluger] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  19. added
    Daily
    and removed
    Weekly
    on Oct 11, 2023
  20. sakluger commented on Oct 13, 2023

    @sakluger
    Contributor

    I completed payment for @SofoniasN and @dukenv0307. @jjcoffee could you please complete the BZ checklist so I can complete your payment as well? Thanks!

  21. jjcoffee commented on Oct 13, 2023

    @jjcoffee
    Contributor
    • The PR that introduced the bug has been identified. Link to the PR: N/A - behaviour has always existed
    • 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: N/A
    • A discussion in #expensify-bugs 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
    • Determine if we should create a regression test for this bug. Yes
    • If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

    Regression Test Proposal

    1. Go to any workspace and select members
    2. Select any member and click on remove
    3. Verify that the search bar regains focus after popover hides

    Do we agree 👍 or 👎

  22. jjcoffee commented on Oct 13, 2023

    @jjcoffee
    Contributor

    @sakluger Checklist complete!

  23. melvin-bot commented on Oct 16, 2023

    @melvin-bot

    @sakluger, @jjcoffee, @jasperhuangg, @dukenv0307 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  24. sakluger commented on Oct 16, 2023

    @sakluger
    Contributor

    Thanks @jjcoffee! I updated the steps a bit to make them more clear, mainly by using the exact link/button names as well as adding two more steps to cover inviting as well as removing.

    I completed payment through Upwork. Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions