Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 6 tasks
kbecciv opened this issue Sep 7, 2023 · 34 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Sep 7, 2023

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
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 7, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 7, 2023

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

@dukenv0307
Copy link
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();
}

@namhihi237
Copy link
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

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

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

@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Sep 11, 2023
@melvin-bot melvin-bot bot 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 Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01cd4466f923f82031

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

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

@sakluger
Copy link
Contributor

Added external label.

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

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

@jjcoffee
Copy link
Contributor

Sorry couldn't get to this today, will review tomorrow!

@jjcoffee
Copy link
Contributor

@dukenv0307 is missing the second case in their proposal, but otherwise correct RCA and solution.

@namhihi237 has the correct RCA(s) and their solution is fine, but I'm wondering if we should apply this pattern here (for handling focus when the page is visible again). I also think we might want a shouldFocusOnSelectRow prop like in OptionsSelector.

if (this.props.shouldShowTextInput && this.props.shouldFocusOnSelectRow) {

🎀👀🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

Triggered auto assignment to @jasperhuangg, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@dukenv0307
Copy link
Contributor

@jjcoffee the second case is already fixed #26415.

@jjcoffee
Copy link
Contributor

jjcoffee commented Sep 14, 2023

@dukenv0307 Ah thanks for the heads up and apologies for missing that! @jasperhuangg Let's go with @dukenv0307's proposal then since it was first and handles the only remaining case.

@sakluger
Copy link
Contributor

@jasperhuangg friendly bump.

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Sep 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 21, 2023

@sakluger @jjcoffee @jasperhuangg this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Sep 21, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

📣 @jjcoffee 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

📣 @SofoniasN 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 23, 2023
@dukenv0307
Copy link
Contributor

@jjcoffee The PR is ready to review.

@jjcoffee
Copy link
Contributor

Thanks @dukenv0307, will review tomorrow!

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @dukenv0307 got assigned: 2023-09-22 22:18:48 Z
  • when the PR got merged: 2023-10-02 19:15:43 UTC
  • days elapsed: 5

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 5, 2023
@melvin-bot melvin-bot bot 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 Oct 5, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 5, 2023

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:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 11, 2023
@sakluger
Copy link
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!

@jjcoffee
Copy link
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 👎

@jjcoffee
Copy link
Contributor

@sakluger Checklist complete!

@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

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

@sakluger
Copy link
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!

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants