App
App copied to clipboard
[$500] Taxes - User can access the background list using the arrow keys while the RHP is open
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:
- Go to Paid workspace > Taxes
- Open one tax setting
- Press on the down and up arrow keys on the keyboard
- Go back and go to categories settings
- Open one category setting
- 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
- [x] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/a6ac1e8d-cdca-4362-a052-9c07a0de9ee4
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
Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
@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
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
https://github.com/Expensify/App/blob/e87d35d8af177df33c4fdfbf221ead732efec310/src/components/ArrowKeyFocusManager.js#L79-L83
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
https://github.com/Expensify/App/blob/e87d35d8af177df33c4fdfbf221ead732efec310/src/components/ArrowKeyFocusManager.js#L80
https://github.com/Expensify/App/blob/e87d35d8af177df33c4fdfbf221ead732efec310/src/components/ArrowKeyFocusManager.js#L99
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
https://github.com/Expensify/App/blob/669099756dc09345a4415495f168604f7df9d2bb/src/components/SelectionList/BaseSelectionList.tsx#L467
https://github.com/Expensify/App/blob/3a61938f54e46211152a2b42832ae3946cad847b/src/components/OptionsSelector/BaseOptionsSelector.js#L617
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?
-
Add
const isFocused = useIsFocused();here and adddisableKeyboardShortcuts={!isFocused}prop to SelectionList -
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)
Job added to Upwork: https://www.upwork.com/jobs/~01008d99761a20e1bb
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jayeshmangwani (External)
@jayeshmangwani we have some proposals for review above β thanks!
Checking if this is VIP-VSP here
Actually, it's wave-collect so assigning that now π
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:
https://github.com/Expensify/App/assets/35371050/e9689fd9-c0d2-45ab-b732-ab7ddbd807de
π π π C+ reviewed
Triggered auto assignment to @pecanoro, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Proposal
Updated. Simplified changes and and fixed the issue in BaseSelectionList level to cover it for all screens
Take a look please @jayeshmangwani @pecanoro
Assigning @ZhenjaHorbach to the issue!
π£ @jayeshmangwani π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @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 π 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
PR hit staging earlier today!
For some reason this did not move to daily or apply payment details, but payment is due to day!
Payment Summary
@jayeshmangwani β paid $500 via Upwork @ZhenjaHorbach β paid $500 via Upwork
@jayeshmangwani can you confirm if this needs a regression test and make the proposal before EOD? Thank you!
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
- Go to Collect Workspace> Taxes
- Open one tax setting
- Press the down and up arrow keys on the keyboard
- Verify that pressing the arrow keys on the keyboard does nothing, as there is an RHP open
- Go back and go to categories settings
- Open one category setting
- Press the down and up arrow keys on the keyboard
- Verify that pressing the arrow keys on the keyboard does nothing, as there is an RHP open
Do you agree π or π ?
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
- Go to Collect Workspace> Taxes
- Open one tax setting
- Press the down and up arrow keys on the keyboard
- Verify that pressing the arrow keys on the keyboard does nothing, as there is an RHP open
- Go back and go to categories settings
- Open one category setting
- Press the down and up arrow keys on the keyboard
- Verify that pressing the arrow keys on the keyboard does nothing, as there is an RHP open
Do you agree π or π ?
@CortneyOfstad
Sorry about that @jayeshmangwani! I agree to the regression test and getting that created now!
Regression is here β closing!