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 2024-06-05] [$250] Group chat - Inconsistency with highlight of group admin row by cursor, up & down and Tab key #41570

Closed
2 of 6 tasks
izarutskaya opened this issue May 3, 2024 · 24 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

@izarutskaya
Copy link

izarutskaya commented May 3, 2024

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: 1.4.70-0
Reproducible in staging?: Y
Reproducible in production?: Y
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a group chat.
  3. Click on the tap header > Members.
  4. Navigate through member list by keyboard up and down key.
  5. Note that admin cannot be navigated with up and down key and is not highlighted.
  6. Click on the admin.
  7. Click back button.
  8. Note that admin is highlighted.
  9. Now navigate through member list with Tab key.

Expected Result:

There should be consistency in whether group admin row can be highlighted.

Actual Result:

In Step 4, group admin cannot be selected and highlighted by keyboard up and down key.
In Step 7, when clicking on the group admin with cursor, the group admin is selected and highlighted.
In Step 9, with Tab key, group admin can be selected and highlighted.

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6469867_1714729821811.20240503_174407.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012cce511dc289f3d0
  • Upwork Job ID: 1786399061346992128
  • Last Price Increase: 2024-05-03
  • Automatic offers:
    • DylanDylann | Contributor | 0
    • bernhardoj | Contributor | 0
Issue OwnerCurrent Issue Owner: @puneetlath
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 3, 2024
Copy link

melvin-bot bot commented May 3, 2024

Triggered auto assignment to @puneetlath (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.

@izarutskaya
Copy link
Author

We think this issue might be related to the #vip-vsb.

@Krishna2323
Copy link
Contributor

Proposal

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

Group chat - Inconsistency with highlight of group admin row by cursor, up & down and Tab key

What is the root cause of that problem?

The option is included in disabledOptionsIndexes if item.isDisabledCheckbox is true but that doesn't makes sense because the item can be still clickable/selectable only checkbox should be disabled.

if (!!section.isDisabled || item.isDisabled || item.isDisabledCheckbox) {
disabledOptionsIndexes.push(disabledIndex);
}

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

Remove item.isDisabledCheckbox check.

What alternative solutions did you explore? (Optional)

@bernhardoj
Copy link
Contributor

Proposal

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

We can highlight the admin member in group participants page with Tab key or when clicking it to open the detail and go back.

What is the root cause of that problem?

In group member/participant, the checkbox will be disabled if it's the current user, which means the item itself is still enabled, only the checkbox is disabled.

isDisabledCheckbox: accountID === currentUserAccountID,

So, we can use TAB key to focus on the item, and isItemFocused will be true because it's not disabled.

const isDisabled = !!section.isDisabled || item.isDisabled;
const isItemFocused = !isDisabled && (focusedIndex === normalizedIndex || itemsToHighlight?.has(item.keyForList ?? ''));

But we can't focus on it with the arrow key because it's included in the disabledOptionsIndexes.

if (!!section.isDisabled || item.isDisabled || item.isDisabledCheckbox) {
disabledOptionsIndexes.push(disabledIndex);
}

const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({
initialFocusedIndex: flattenedSections.allOptions.findIndex((option) => option.keyForList === initiallyFocusedOptionKey),
maxIndex: Math.min(flattenedSections.allOptions.length - 1, CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH * currentPage - 1),
disabledIndexes: flattenedSections.disabledOptionsIndexes,

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

If the expectation is to allow the user to focus on the item that only has a checkbox disabled with the arrow key, then we can either

  1. Filter out the disabled indexes that have the disabled checkbox value as true.
    disabledIndexes: flattenedSections.disabledOptionsIndexes,
disabledIndexes: flattenedSections.disabledOptionsIndexes.filter((index) => !flattenedSections.allOptions[index].isDisabledCheckbox),
  1. Or create a new disabled indexes array (disabledArrowKeyOptionsIndexes) for the arrow key that doesn't contain the checkbox disabled item.
if (!!section.isDisabled || item.isDisabled || item.isDisabledCheckbox) {
    disabledOptionsIndexes.push(disabledIndex);
    if (!item.isDisabledCheckbox) {
        disabledArrowKeyOptionsIndexes.push(disabledIndex);
    }
}

We need to keep the disabledOptionsIndexes as is, otherwise, the select all button will be enabled even if the only member left is the admin.

If the expectation is to prevent the disabled checkbox item from being focused/highlighted, then we need to add it to the disabled condition here.

const isDisabled = !!section.isDisabled || item.isDisabled;
const isItemFocused = !isDisabled && (focusedIndex === normalizedIndex || itemsToHighlight?.has(item.keyForList ?? ''));

const isItemFocused = (!isDisabled && !item.isDisabledCheckbox) && ...

but it will still be able to have the blue outline focus (when we use TAB) because the pressable is not disabled.
image

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label May 3, 2024
@melvin-bot melvin-bot bot changed the title Group chat - Inconsistency with highlight of group admin row by cursor, up & down and Tab key [$250] Group chat - Inconsistency with highlight of group admin row by cursor, up & down and Tab key May 3, 2024
Copy link

melvin-bot bot commented May 3, 2024

Job added to Upwork: https://www.upwork.com/jobs/~012cce511dc289f3d0

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 3, 2024
Copy link

melvin-bot bot commented May 3, 2024

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

@dragnoir
Copy link
Contributor

dragnoir commented May 6, 2024

Proposal

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

Group chat - Inconsistency with highlight of group admin row by cursor, up & down and Tab key

What is the root cause of that problem?

The BaseSelectionList component doesn't allow the keyboard to navigate through items with a disabled checkbox

if (!!section.isDisabled || item.isDisabled || item.isDisabledCheckbox) {
disabledOptionsIndexes.push(disabledIndex);
}

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

If we remove the item.isDisabledCheckbox here the disabledOptionsIndexes will be missing one item and that will cause many regressions like when all members removed, and only admin on the list, the Select all checkbox will not be disabled.

We can add a new prop to BaseSelectionList like shouldAllowAllKeyboardNavigation default to false
and pass it to the page ReportParticipantsPage

<SelectionList
ref={selectionListRef}
canSelectMultiple={isGroupChat && isCurrentUserAdmin}
sections={[{data: participants}]}
ListItem={TableListItem}
headerContent={headerContent}
onSelectRow={openMemberDetails}
onCheckboxPress={(item) => toggleUser(item.accountID)}
onSelectAll={() => toggleAllUsers(participants)}
showScrollIndicator
textInputRef={textInputRef}
customListHeader={customListHeader}
listHeaderWrapperStyle={[styles.ph9]}
/>

When the new prop is true, we tell the useArrowKeyFocusManager here to navigate throw all elements

const [focusedIndex, setFocusedIndex] =  useArrowKeyFocusManager({
  initialFocusedIndex:  flattenedSections.allOptions.findIndex((option) =>  option.keyForList  ===  initiallyFocusedOptionKey),
  maxIndex:  Math.min(flattenedSections.allOptions.length  -  1, CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH  *  currentPage  -  1),
- disabledIndexes: flattenedSections.disabledOptionsIndexes,
+ disabledIndexes:  shouldAllowAllKeyboardNavigation  ? [] :  flattenedSections.disabledOptionsIndexes,
  isActive:  true,
  // ...
});

In our example, we should allow the user to be able to navigate through all items, because even if some items are disabled, the user can go through the details page to see more details about their profile.

By adding this new props, we get rid of complexity and conflicts and we simply allow the keyboard to navigate throw all items.

@melvin-bot melvin-bot bot added the Overdue label May 6, 2024
@Santhosh-Sellavel
Copy link
Collaborator

Asked for volunteers to pick this up here

@Santhosh-Sellavel Santhosh-Sellavel removed their assignment May 6, 2024
@melvin-bot melvin-bot bot removed the Overdue label May 6, 2024
@Santhosh-Sellavel
Copy link
Collaborator

Unassigned myself due to less bandwidth

@DylanDylann
Copy link
Contributor

I will take over this one as C+

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 6, 2024
Copy link

melvin-bot bot commented May 6, 2024

📣 @DylanDylann 🎉 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 📖

@puneetlath puneetlath added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 6, 2024
@puneetlath
Copy link
Contributor

Putting the Help Wanted label back on. @DylanDylann is taking the C+ role, so we're still looking for a contributor.

@DylanDylann
Copy link
Contributor

DylanDylann commented May 7, 2024

Before evaluating proposals, we need to confirm the expectation first with @Expensify/design

  1. Let's see the tab key behavior, when clicking the tab key we will focus on the member border
Screenshot 2024-05-07 at 22 13 23

In here, If we click enter, the detail member will open
On the other hand, If we click the tab key one more time, the checkbox will be focused
Screenshot 2024-05-07 at 22 13 06
Here, if we click enter, the checkbox will be selected

IMO, the current behavior is correct

  1. Let's see the up/down behavior, when clicking the down/up key we will focus on the member border
Screenshot 2024-05-07 at 22 13 23

Here, If we click enter, the detail member will open. If we click the down/up key one more time, the App will focus on the next member border (If the next member border is admin, we will skip it and go to the next item)

Screen.Recording.2024-05-07.at.22.19.38.mov

IMO, with the current behavior, when clicking up/down key we shouldn't skip the admin member because we allow user to open the detail page of the admin

@dragnoir
Copy link
Contributor

dragnoir commented May 7, 2024

Tab navigation will be handled here #36476
I think we should focus on arrow keys.

@dannymcclain
Copy link
Contributor

IMO, with the current behavior, when clicking up/down key we shouldn't skip the admin member because we allow user to open the detail page of the admin

I agree with this. I would expect to be able to arrow through the list and hit enter to open each member's profile.

@DylanDylann
Copy link
Contributor

DylanDylann commented May 9, 2024

@Krishna2323 Your proposal will make the select all button break
@dragnoir When we pass an empty array to disabledIndexes, we miss the disabled item (section.isDisabled || item.isDisabled)
I like @bernhardoj's solution 2. Let's go with them

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented May 9, 2024

Current assignee @puneetlath is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 9, 2024
Copy link

melvin-bot bot commented May 9, 2024

📣 @bernhardoj 🎉 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 📖

@bernhardoj
Copy link
Contributor

PR is ready

cc: @DylanDylann

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 29, 2024
@melvin-bot melvin-bot bot changed the title [$250] Group chat - Inconsistency with highlight of group admin row by cursor, up & down and Tab key [HOLD for payment 2024-06-05] [$250] Group chat - Inconsistency with highlight of group admin row by cursor, up & down and Tab key May 29, 2024
Copy link

melvin-bot bot commented May 29, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 29, 2024
Copy link

melvin-bot bot commented May 29, 2024

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

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

Copy link

melvin-bot bot commented May 29, 2024

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:

  • [@DylanDylann] The PR that introduced the bug has been identified. Link to the PR:
  • [@DylanDylann] 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:
  • [@DylanDylann] 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:
  • [@DylanDylann] Determine if we should create a regression test for this bug.
  • [@DylanDylann] 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.
  • [@puneetlath] 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 Overdue and removed Weekly KSv2 labels Jun 4, 2024
@DylanDylann
Copy link
Contributor

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:

[@DylanDylann] The PR that introduced the bug has been identified. Link to the PR: NA
[@DylanDylann] 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: NA
[@DylanDylann] 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: NA
[@DylanDylann] Determine if we should create a regression test for this bug. Yes
[@DylanDylann] 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

Prerequisite: Create a new group chat

  1. Open the group chat
  2. Press the header to open the detail and press Members
  3. Use arrow key/down to navigate between the list
  4. Verify it can highlight the admin member.

Do we agree 👍 or 👎

@puneetlath
Copy link
Contributor

Issue for regression test: https://github.com/Expensify/Expensify/issues/402260

Everyone has been paid. Thanks y'all!

@melvin-bot melvin-bot bot removed the Overdue label Jun 5, 2024
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
No open projects
Archived in project
Development

No branches or pull requests

8 participants