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

[$500] Workspace - Invite member - Member highlights on deselect all members #27377

Closed
6 tasks done
kbecciv opened this issue Sep 13, 2023 · 29 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Sep 13, 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. Go to settings> workspace
  2. Create new workspace if not created
  3. Go to members
  4. Invite any 2 members
  5. Click on select all check box
  6. Deselect last selected member
  7. Deselect second selected member

Expected Result:

Member should not be highlights

Actual Result:

Member highlights

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.69.0
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

RPReplay_Final1694422450.MP4
Screen_Recording_20230913_125101_New.Expensify.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f0d617af5beeb293
  • Upwork Job ID: 1702003634763894784
  • Last Price Increase: 2023-09-13
  • Automatic offers:
    • s77rt | Reviewer | 26724768
    • akamefi202 | Contributor | 26724771
    • gadhiyamanan | Reporter | 26724774
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 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

@melvin-bot melvin-bot bot changed the title Workspace - Invite member - Member highlights on deselect all members [$500] Workspace - Invite member - Member highlights on deselect all members Sep 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

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

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

melvin-bot bot commented Sep 13, 2023

Triggered auto assignment to @joekaufmanexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

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

@joekaufmanexpensify
Copy link
Contributor

@Christinadobrzyn I was duplicate assigned here, so un-assigning as this doesn't need two BZ members. We are fixing this here.

@joekaufmanexpensify joekaufmanexpensify removed their assignment Sep 13, 2023
@akamefi202
Copy link
Contributor

akamefi202 commented Sep 13, 2023

Proposal

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

Member highlights on deselect all members in workspace members page.

What is the root cause of that problem?

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 user select/deselect a member, selectRow function is called and the function focuses the next member in the list.

const selectFocusedOption = () => {
const focusedOption = flattenedSections.allOptions[focusedIndex];
if (!focusedOption || focusedOption.isDisabled) {
return;
}
selectRow(focusedOption, focusedIndex);
};

This is implemented for continuous selection & deselection by Enter keyboard shortcut.
The code is written inside selectRow function and it will be called from selectFocusedOption.

But selectRow function is also called if the user select/deselect by click/press.
So the next member will be focused too and we see current issue.

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

<UserListItem
item={item}
isFocused={isFocused}
onSelectRow={() => selectRow(item, index)}
onDismissError={onDismissError}
showTooltip={showTooltip}
/>

I think we need to call onSelectRow function directly instead of calling selectRow function if the user select/deselect by click/press.
So the app will only toggle the item without moving focus to the next item.

What alternative solutions did you explore? (Optional)

N/A

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 14, 2023

Proposal

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

  • Member highlights on deselect all members in workspace members page.

What is the root cause of that problem?

  • Currently, we have a logic to auto-focus on the next available item when the users click/press ENTER on the item. The logic is like below:
    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);
    if (!item.isSelected) {
    // If we're selecting an item, scroll to it's position at the top, so we can see it
    scrollToIndex(Math.max(selectedOptionsCount - 1, 0), true);
    }
    }
    }
    onSelectRow(item);
    };

    const selectFocusedOption = () => {
    const focusedOption = flattenedSections.allOptions[focusedIndex];
    if (!focusedOption || focusedOption.isDisabled) {
    return;
    }
    selectRow(focusedOption, focusedIndex);
    };

    /** Selects row when pressing Enter */
    useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, selectFocusedOption, {
    captureOnInputs: true,
    shouldBubble: () => !flattenedSections.allOptions[focusedIndex],
    isActive: !activeElement,
    });
  • And this logic is called for both case: user select item and user deselect item, which lead to the bug: When user deselects the member, the next one is highlights

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

  • In my opinion, I do not think it is a bug, just needs an improvement
  • The logic "Auto focus on the next available item" is only useful when the user uses the ENTER key to select/deselect the items. So we can add the condition to appy this auto-focus logic: The device are desktop/desktop-web. Like below:
 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 && !DeviceCapabilities.canUseTouchScreen()) {
                 // Auto-focus logic
         }

        onSelectRow(item);
    };

  • Based on DeviceCapabilities.canUseTouchScreen(), we maybe can check if the device is desktop or not

What alternative solutions did you explore? (Optional)

  • Also we can just apply the auto-focus next item in case user press the ENTER key to select the items like:
 const selectRow = (item, index, isPressingEnter) => {
          if(isPressingEnterKey) { // Logic auto-focus here}
          onSelectRow(item)
}
  • The isPressingEnter `s default value is false. So the clicking item does not auto-focus on next available item. In the callback function to handle ENTER press - selectFocusedOption, we will call selectRow with isPressingEnter is true

Result

  • First proposal: Mobile web
Screencast.from.14-09-2023.12.25.47.webm

@s77rt
Copy link
Contributor

s77rt commented Sep 14, 2023

@akamefi202 Thanks for the proposal. Your RCA is correct and the solution looks good to me.

🎀 👀 🎀 C+ reviewed
Link to proposal

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

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

@s77rt
Copy link
Contributor

s77rt commented Sep 14, 2023

@DylanDylann Thanks for the proposal. Your RCA is correct. The first solution i.e. the use of DeviceCapabilities.canUseTouchScreen does not seem correct for this case (the feature is related to keyboard not touchscreen) and the second solution is a pretty much the same as the one proposed by @akamefi202.

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 14, 2023

@s77rt I think based on DeviceCapabilities.canUseTouchScreen and maybe any additional conditions in the detail PR, we can know that whether the device is desktop or not. So only desktop device can use the keyboard in this case, right? The main idea from my proposal is that: We will disable the auto-focus logic with the devices that do not have ENTER button

@Christinadobrzyn
Copy link
Contributor

Hey @techievivek can you take a peek at this #27377 (comment)

@s77rt
Copy link
Contributor

s77rt commented Sep 14, 2023

@DylanDylann The !DeviceCapabilities.canUseTouchScreen() condition would be true on Web/Desktop, this won't change anything and the issue would be still reproducible on those platforms.

@DylanDylann
Copy link
Contributor

@s77rt why "this won't change anything and the issue would be still reproducible on those platforms."? In mobile, !DeviceCapabilities.canUseTouchScreen() will be false so the auto-focus logic is not applied based on my proposal. Please help give me more detail

@DylanDylann
Copy link
Contributor

Also, should we need to confirm whether the auto-focus on the item when deselecting item is intention or not @s77rt

@s77rt
Copy link
Contributor

s77rt commented Sep 15, 2023

@DylanDylann

why "this won't change anything and the issue would be still reproducible on those platforms."? In mobile, !DeviceCapabilities.canUseTouchScreen() will be false so the auto-focus logic is not applied

Right, but on Web/Desktop the issue would be still there. We need to fix the bug for all the platforms.

should we need to confirm whether the auto-focus on the item when deselecting item is intention or not

It's intentional based on the code comments

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

melvin-bot bot commented Sep 18, 2023

📣 @s77rt 🎉 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 melvin-bot bot added the Overdue label Sep 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

📣 @akamefi202 🎉 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 18, 2023

📣 @gadhiyamanan 🎉 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

@akamefi202
Copy link
Contributor

Thank you. The PR will be ready by tomorrow.

@melvin-bot melvin-bot bot removed the Overdue label Sep 18, 2023
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 18, 2023
@akamefi202
Copy link
Contributor

@s77rt I closed the PR.

@Christinadobrzyn
Copy link
Contributor

Reached out to BZ about payment - https://expensify.slack.com/archives/C01SKUP7QR0/p1695743819720659

@Christinadobrzyn
Copy link
Contributor

Follow up from the team is to do a case-by-case evaluation of the work done on the GH and PR.

@s77rt @akamefi202 @techievivek what do you think is fair payment for the work on this job/PR?

@s77rt
Copy link
Contributor

s77rt commented Sep 26, 2023

I think 50% would be fair for this case.

@Christinadobrzyn
Copy link
Contributor

Sounds good! Sorry, I'm a little lost here... The job was fixed elsewhere and we can close this, right?

How's this for payouts due:

Issue Reporter: $50 @gadhiyamanan
Contributor: $250 @akamefi202
Contributor+: $250 @s77rt

Eligible for 50% #urgency bonus? N

Upwork job is here.

@Christinadobrzyn Christinadobrzyn added Daily KSv2 and removed Weekly KSv2 labels Sep 29, 2023
@akamefi202
Copy link
Contributor

akamefi202 commented Oct 3, 2023

@s77rt @Christinadobrzyn @techievivek
Can we please close this issue soon if everything is clear here?

@s77rt
Copy link
Contributor

s77rt commented Oct 3, 2023

@Christinadobrzyn Sorry I missed the question

The job was fixed elsewhere and we can close this, right?

Yes. it was fixed here #27246

@Christinadobrzyn
Copy link
Contributor

Thanks! Paid this out in Upwork based on #27377 (comment)

Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

7 participants