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-05-06] [$250] Web - Group chat - Three presses on down arrow are required to bring selection back to top #40583

Closed
2 of 6 tasks
lanitochka17 opened this issue Apr 19, 2024 · 29 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Apr 19, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.63-7
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to FAB > Start chat
  3. Select two members > Next
  4. Using keyboard, press down arrow to reach the second user
  5. Press down arrow again

Expected Result:

One press on down arrow on the last member will bring the selection back to the top

Actual Result:

Three presses on down arrow on the last member are required to bring the selection back to the top

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

Add any screenshot/video evidence

Bug6454995_1713538126352.20240419_224517.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0153b6fdbab8d7d8d4
  • Upwork Job ID: 1781447995713212416
  • Last Price Increase: 2024-04-19
  • Automatic offers:
    • jayeshmangwani | Reviewer | 0
    • tienifr | Contributor | 0
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Apr 19, 2024
Copy link

melvin-bot bot commented Apr 19, 2024

Triggered auto assignment to @cead22 (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@lanitochka17
Copy link
Author

@cead22 FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@marcaaron
Copy link
Contributor

Gonna remove the Deploy Blocker label on this one

@marcaaron marcaaron added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Apr 19, 2024
Copy link

melvin-bot bot commented Apr 19, 2024

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

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Apr 19, 2024

Proposal

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

Web - Group chat - Three presses on down arrow are required to bring selection back to top

What is the root cause of that problem?

The main problem with issue is that we don't ignore disabled items in the list
As a result when we focus on a disabled element, it doesn't visually change
But the focus is on this element
And in order to move to the next active element we need to do an additional press

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

To fix this issue we can pass disabledIndexes param for useArrowKeyFocusManager

    const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({
        initialFocusedIndex: flattenedSections.allOptions.findIndex((option) => option.keyForList === initiallyFocusedOptionKey),
        maxIndex: flattenedSections.allOptions.length - 1,
        isActive: true,
        onFocusedIndexChange: (index: number) => {
            scrollToIndex(index, true);
        },
        isFocused,
        disabledIndexes: flattenedSections.disabledOptionsIndexes,
    });

const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({
initialFocusedIndex: flattenedSections.allOptions.findIndex((option) => option.keyForList === initiallyFocusedOptionKey),
maxIndex: Math.min(flattenedSections.allOptions.length, CONST.MAX_OPTIONS_SELECTOR_PAGE_LENGTH * currentPage - 1),
isActive: true,
onFocusedIndexChange: (index: number) => {
scrollToIndex(index, true);
},
isFocused,
});

Plus in this ticket we should check all places where we use useArrowKeyFocusManager and check ability to add disabledIndexes

What alternative solutions did you explore? (Optional)

NA

@cead22 cead22 added the External Added to denote the issue can be worked on by a contributor label Apr 19, 2024
@melvin-bot melvin-bot bot changed the title Web - Group chat - Three presses on down arrow are required to bring selection back to top [$250] Web - Group chat - Three presses on down arrow are required to bring selection back to top Apr 19, 2024
Copy link

melvin-bot bot commented Apr 19, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0153b6fdbab8d7d8d4

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

melvin-bot bot commented Apr 19, 2024

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

@saifelance
Copy link

saifelance commented Apr 20, 2024

@MelvinBot
To address this issue, the proposed solution is to introduce a disabledIndexes parameter for the useArrowKeyFocusManager hook. By passing an array of disabled indexes to the useArrowKeyFocusManager,

Here's the change in code:

const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({
    initialFocusedIndex: flattenedSections.allOptions.findIndex((option) => option.keyForList === initiallyFocusedOptionKey),
    maxIndex: flattenedSections.allOptions.length - 1,
    isActive: true,
    onFocusedIndexChange: (index: number) => {
        scrollToIndex(index, true);
    },
    isFocused,
    disabledIndexes: flattenedSections.disabledOptionsIndexes,
});

Copy link

melvin-bot bot commented Apr 20, 2024

📣 @saifelance! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@saifelance
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/saifurrehman

Copy link

melvin-bot bot commented Apr 20, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@saifelance
Copy link

👍

@tienifr
Copy link
Contributor

tienifr commented Apr 20, 2024

Proposal

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

Three presses on down arrow on the last member are required to bring the selection back to the top

What is the root cause of that problem?

In the group chat confirmation page, we have a selection list with 3 members, one of them is the Admin and is disabled. It requires 3 arrow presses to go back to top because:

  1. We're not ignoring disabled options here via the disabledIndexes prop. That means one of the arrow press goes to this disabled item.
  2. Even after we set disabledIndexes prop, it will still take 2 presses to go to the top. That's because in here, we're setting the wrong maxIndex for the useArrowKeyFocusManager. The maxIndex's purpose is so that we know whether we reached the edge of the list and should go to top/bottom in a cyclic manner. If the list has 3 items, the maxIndex should be 2 (there's item 0, 1, 2). However we're setting the maxIndex to the length of the list (3 here), leading to the focus being moved outside of the screen when we do the ArrowDown when we're at the last item of the list (same as when we're on top of the list and ArrowUp). So one of the arrow presses get focus outside of the list (to the imaginary n-th element in a 0, 1, ..., n-1 list)

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

  1. In here, add
disabledIndexes: flattenedSections.disabledOptionsIndexes,
  1. In here, update flattenedSections.allOptions.length to flattenedSections.allOptions.length - 1 to correctly identify the index of the last item in the list.
    (we're using that - 1 everywhere else like here)

We should also double check other usage of useArrowKeyFocusManager and make sure the above 2 fields are set correctly.

What alternative solutions did you explore? (Optional)

NA

@saifelance
Copy link

@tienifr

To solve the problem described, you can follow the proposed changes:

  1. Add disabledIndexes prop: Include the disabledIndexes prop in the selection list component and pass the indexes of disabled items to it. This will ensure that arrow key navigation skips over disabled items.
  2. Update maxIndex calculation: Adjust the calculation of maxIndex in the useArrowKeyFocusManager hook so that it correctly represents the maximum index of the navigable items. This ensures that the focus doesn't move outside the list when navigating with arrow keys.
// 1. Add disabledIndexes prop
const SelectionList = ({ options, flattenedSections }) => {
    // Other component code...

    // Pass disabledIndexes prop to useArrowKeyFocusManager
    const { focusedIndex, disabledIndexes, handleKeyDown } = useArrowKeyFocusManager({
        maxIndex: flattenedSections.allOptions.length - 1, // Update maxIndex calculation
        // Other props...
        disabledIndexes: flattenedSections.disabledOptionsIndexes, // Add disabledIndexes prop
    });

    // Other component code...
};

// 2. Update maxIndex calculation in useArrowKeyFocusManager hook
const useArrowKeyFocusManager = ({ maxIndex, disabledIndexes }) => {
    // Other hook code...

    const handleArrowDown = () => {
        if (focusedIndex < maxIndex) {
            const nextIndex = findNextNavigableIndex(focusedIndex + 1, maxIndex, disabledIndexes);
            setFocusedIndex(nextIndex);
        } else {
            // Wrap around to the top of the list
            setFocusedIndex(findNextNavigableIndex(0, maxIndex, disabledIndexes));
        }
    };

    const handleArrowUp = () => {
        if (focusedIndex > 0) {
            const prevIndex = findPrevNavigableIndex(focusedIndex - 1, maxIndex, disabledIndexes);
            setFocusedIndex(prevIndex);
        } else {
            // Wrap around to the bottom of the list
            setFocusedIndex(findPrevNavigableIndex(maxIndex, maxIndex, disabledIndexes));
        }
    };

    // Other hook code...
};

@melvin-bot melvin-bot bot added the Overdue label Apr 22, 2024
@jayeshmangwani
Copy link
Contributor

Thanks for the proposals @ZhenjaHorbach and @tienifr. @tienifr 's Proposal looks good; we can proceed with it.

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Apr 22, 2024
Copy link

melvin-bot bot commented Apr 22, 2024

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

@marcaaron marcaaron assigned tienifr and unassigned cead22 Apr 22, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 22, 2024
@marcaaron marcaaron self-assigned this Apr 22, 2024
Copy link

melvin-bot bot commented Apr 22, 2024

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

Copy link

melvin-bot bot commented Apr 22, 2024

📣 @tienifr 🎉 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 melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 23, 2024
@tienifr
Copy link
Contributor

tienifr commented Apr 23, 2024

PR ready for review #40773

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 29, 2024
@melvin-bot melvin-bot bot changed the title [$250] Web - Group chat - Three presses on down arrow are required to bring selection back to top [HOLD for payment 2024-05-06] [$250] Web - Group chat - Three presses on down arrow are required to bring selection back to top Apr 29, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 29, 2024
Copy link

melvin-bot bot commented Apr 29, 2024

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

Copy link

melvin-bot bot commented Apr 29, 2024

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

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

Copy link

melvin-bot bot commented Apr 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:

  • [@jayeshmangwani] The PR that introduced the bug has been identified. Link to the PR:
  • [@jayeshmangwani] 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:
  • [@jayeshmangwani] 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:
  • [@jayeshmangwani] Determine if we should create a regression test for this bug.
  • [@jayeshmangwani] 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.
  • [@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@jayeshmangwani
Copy link
Contributor

jayeshmangwani commented May 6, 2024

Regression Test Proposal

  1. Open the App, Press FAB > Start chat
  2. Select several members > Next
  3. Using the keyboard, press the down arrow several times
  4. Verify the group owner is not focused at all
  5. Verify only one arrow press moves the focus from one member to the next, which for the last member it means that pressing the down arrow puts the focus on the first member, and for the first member it means that pressing the up arrow puts the focus on the last member

Do we agree 👍 or 👎

@cead22
Copy link
Contributor

cead22 commented May 6, 2024

5. Verify only one arrow press moves the focus from the member above to the member below the group owner

👍 Suggested edit: Verify only one arrow press moves the focus from one member to the next, which for the last member it means that pressing the down arrow puts the focus on the first member, and for the first member it means that pressing the up arrow puts the focus on the last member

@jayeshmangwani
Copy link
Contributor

👍 Suggested edit: Verify only one arrow press moves the focus from one member to the next, which for the last member it means that pressing the down arrow puts the focus on the first member, and for the first member it means that pressing the up arrow puts the focus on the last member

Updated

@isabelastisser
Copy link
Contributor

Payments processed in Upwork.

@isabelastisser
Copy link
Contributor

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. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants