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] [Taxes] User can access the background list using the arrow keys while the RHP is open #39093

Closed
1 of 6 tasks
lanitochka17 opened this issue Mar 27, 2024 · 24 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 27, 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.57-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: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to Paid workspace > Taxes
  2. Open one tax setting
  3. Press on the down and up arrow keys on the keyboard
  4. Go back and go to categories settings
  5. Open one category setting
  6. Press on the down and up arrow keys on the keyboard

Expected Result:

Pressing on the arrow keys on the keyboard should do nothing as there is an RHP open

Actual Result:

Even if RHP is open pressing on the arrow keys moves through the background list

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

Bug6428753_1711549325149.bandicam_2024-03-27_17-18-00-957.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01008d99761a20e1bb
  • Upwork Job ID: 1773361277524193280
  • Last Price Increase: 2024-03-28
  • Automatic offers:
    • jayeshmangwani | Reviewer | 0
    • ZhenjaHorbach | Contributor | 0
Issue OwnerCurrent Issue Owner: @CortneyOfstad
Issue OwnerCurrent Issue Owner: @CortneyOfstad
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 27, 2024
Copy link

melvin-bot bot commented Mar 27, 2024

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

@lanitochka17
Copy link
Author

@CortneyOfstad 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

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Mar 27, 2024

Proposal

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

Taxes - User can access the background list using the arrow keys while the RHP is open

What is the root cause of that problem?

The main problem with the issue is that we do not process this case in any way when we're out of focus inside ArrowKeyFocusManager which we use for BaseOptionsSelector and BaseSelectionList

onArrowUpKey() {
if (this.props.maxIndex < 0) {
return;
}

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

Since we only use this ArrowKeyFocusManager for lists, the best way to fix this is to make changes inside the manager to cover changes for both BaseOptionsSelector and BaseSelectionList

To fix this issue we can update ArrowKeyFocusManager and update condition onArrowUpKey and onArrowDownKey when we're out of focus

For this, we need to create a wrapper to get isFocused value for ArrowKeyFocusManager

function ArrowKeyFocusManager(props) {
    const isFocused = useIsFocused();

    return (
        <ArrowKeyFocusManagerBody
            isFocused={isFocused}
            {...props}
        />
    );
}

export default ArrowKeyFocusManager;

And then update conditions to disable onArrowUpKey and onArrowDownKey when we're out of focus

if (this.props.maxIndex < 0) {

if (this.props.maxIndex < 0) {

if (this.props.maxIndex < 0 || !this.props.isFocused) {

Plus we might want to reset the index offset state when we leave the screen
For this inside BaseOptionsSelector and BaseSelectionList we can set indexOffset as -1 when we leave the current screen using useEffect or componentDidUpdate (As alternative inside ArrowKeyFocusManager)

And if we want, we can always add an additional parameter that will make it possible to interact with lists when we are not in focus (But it doesn't make sense to me)

What alternative solutions did you explore? (Optional)

As an alternative, we can update onFocusedIndexChanged outside the manager
And just disable the index change function when we're out of focus

onFocusedIndexChanged={updateAndScrollToFocusedIndex}

onFocusedIndexChanged={this.props.disableArrowKeysActions ? () => {} : this.updateFocusedIndex}

@shahinyan11
Copy link

shahinyan11 commented Mar 27, 2024

Proposal

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

Taxes - User can access the background list using the arrow keys while the RHP is open

What is the root cause of that problem?

We do not disable Arrow keys for SelectionList here

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

  1. Add const isFocused = useIsFocused(); here and add disableKeyboardShortcuts={!isFocused} prop to SelectionList

  2. Update this line like below

maxIndex={disableKeyboardShortcuts ? -1 : slicedSections.flatMap((section) => section.data).length - 1}

We can add new disableArrowKeys prop to disable the arrow keys instead of using the disableKeyboardShortcuts so as not to use one prop to disable different actions

What alternative solutions did you explore? (Optional)

@CortneyOfstad CortneyOfstad added the External Added to denote the issue can be worked on by a contributor label Mar 28, 2024
@melvin-bot melvin-bot bot changed the title Taxes - User can access the background list using the arrow keys while the RHP is open [$500] Taxes - User can access the background list using the arrow keys while the RHP is open Mar 28, 2024
Copy link

melvin-bot bot commented Mar 28, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01008d99761a20e1bb

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

melvin-bot bot commented Mar 28, 2024

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

@CortneyOfstad
Copy link
Contributor

@jayeshmangwani we have some proposals for review above — thanks!

@CortneyOfstad
Copy link
Contributor

Checking if this is VIP-VSP here

@CortneyOfstad
Copy link
Contributor

Actually, it's wave-collect so assigning that now 👍

@jayeshmangwani
Copy link
Contributor

Thanks for the proposal @shahinyan11 , your changes will work on the Workspace Taxes page but similar issue is on the Workspaces's Distance rates, Categories , Tags pages too, so rather we would fix it in the SelectionList would be the good idea.

@ZhenjaHorbach's Proposal looks good to me, tested locally by applying changes and changes looks good, and @ZhenjaHorbach IMO resetting the index is not needed here when we leave the screen, key down and key up will not work when SectionList's screen is not focused, but keyboard shortcuts will work, adding a video below to checking the effect after applying changes in the proposal

Video:
key-down.mov

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 29, 2024

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

@shahinyan11
Copy link

shahinyan11 commented Mar 29, 2024

Proposal

Updated. Simplified changes and and fixed the issue in BaseSelectionList level to cover it for all screens
Take a look please @jayeshmangwani @pecanoro

@pecanoro
Copy link
Contributor

Assigning @ZhenjaHorbach to the issue!

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

melvin-bot bot commented Mar 29, 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 Mar 29, 2024

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

@ZhenjaHorbach
Copy link
Contributor

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

PR will be ready on the weekend

@melvin-bot melvin-bot bot added the Weekly KSv2 label Mar 30, 2024
@trjExpensify trjExpensify changed the title [$500] Taxes - User can access the background list using the arrow keys while the RHP is open [$500] [Taxes] User can access the background list using the arrow keys while the RHP is open Apr 2, 2024
@trjExpensify
Copy link
Contributor

PR hit staging earlier today!

@CortneyOfstad
Copy link
Contributor

For some reason this did not move to daily or apply payment details, but payment is due to day!

@CortneyOfstad
Copy link
Contributor

Payment Summary

@jayeshmangwani — paid $500 via Upwork
@ZhenjaHorbach — paid $500 via Upwork

@CortneyOfstad
Copy link
Contributor

@jayeshmangwani can you confirm if this needs a regression test and make the proposal before EOD? Thank you!

@jayeshmangwani
Copy link
Contributor

This is not a regression from any PR, but it was missed when we created ArrowKeyFocusManager, and later, the issue was visible after we created RHP. I am proposing regression test steps below. Please let me know if you have any other suggestions

Regression Test Steps

  1. Go to Collect Workspace> Taxes
  2. Open one tax setting
  3. Press the down and up arrow keys on the keyboard
  4. Verify that pressing the arrow keys on the keyboard does nothing, as there is an RHP open
  5. Go back and go to categories settings
  6. Open one category setting
  7. Press the down and up arrow keys on the keyboard
  8. Verify that pressing the arrow keys on the keyboard does nothing, as there is an RHP open

Do you agree 👍 or 👎 ?

@jayeshmangwani
Copy link
Contributor

This is not a regression from any PR, but it was missed when we created ArrowKeyFocusManager, and later, the issue was visible after we created RHP. I am proposing regression test steps below. Please let me know if you have any other suggestions

Regression Test Steps

  1. Go to Collect Workspace> Taxes
  2. Open one tax setting
  3. Press the down and up arrow keys on the keyboard
  4. Verify that pressing the arrow keys on the keyboard does nothing, as there is an RHP open
  5. Go back and go to categories settings
  6. Open one category setting
  7. Press the down and up arrow keys on the keyboard
  8. Verify that pressing the arrow keys on the keyboard does nothing, as there is an RHP open

Do you agree 👍 or 👎 ?

@CortneyOfstad

@pecanoro pecanoro removed the Reviewing Has a PR in review label Apr 23, 2024
@CortneyOfstad
Copy link
Contributor

Sorry about that @jayeshmangwani! I agree to the regression test and getting that created now!

@CortneyOfstad
Copy link
Contributor

Regression is here — 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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants