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 2025-01-18] [HOLD for payment 2025-01-17] Web - Expense - Unable to navigate to different currency via keyboard #54931

Closed
2 of 8 tasks
mitarachim opened this issue Jan 8, 2025 · 23 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 Engineering

Comments

@mitarachim
Copy link

mitarachim commented Jan 8, 2025

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: 9.0.82-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5425260
Email or phone of affected tester (no customers): applausetester+010108kh@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.0 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Open FAB > Create expense.
  3. Click on the currency.
  4. Press keyboard down key.
  5. If there are other currencies in Recent list, press keyboard down key until it reaches All section.

Expected Result:

The selection will move to the next currency.

Actual Result:

The selection moves to the next currency, then back to the selected currency.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6708775_1736312366220.20250108_125737.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @twisterdotcom
@mitarachim mitarachim added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 8, 2025
Copy link

melvin-bot bot commented Jan 8, 2025

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

Copy link

melvin-bot bot commented Jan 8, 2025

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

Copy link

melvin-bot bot commented Jan 8, 2025

💬 A slack conversation has been started in #expensify-open-source

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Jan 8, 2025
Copy link
Contributor

github-actions bot commented Jan 8, 2025

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

@ishakakkad
Copy link
Contributor

Proposal

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

When navigate currency using keyboard, currency focus reset to previously selected item.

What is the root cause of that problem?

When navigating using the keyboard and scrolling occurs, the previously selected currency is focused because the item heights are recalculated.

const onItemLayout = (event: LayoutChangeEvent, itemKey: string | null | undefined) => {
if (!itemKey) {
return;
}
const {height} = event.nativeEvent.layout;
setItemHeights((prevHeights) => ({
...prevHeights,
[itemKey]: height,
}));
};

Due to this flattenedSections modified and the currently selected item gets focused.

return {
allOptions,
selectedOptions,
disabledOptionsIndexes,
disabledArrowKeyOptionsIndexes,
itemLayouts,
allSelected: selectedOptions.length > 0 && selectedOptions.length === allOptions.length - disabledOptionsIndexes.length,
};
}, [canSelectMultiple, sections, customListHeader, customListHeaderHeight, itemHeights, getItemHeight]);

useEffect(() => {
const selectedItemIndex = flattenedSections.allOptions.findIndex((option) => option.isSelected);
if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex) {
return;
}
setFocusedIndex(selectedItemIndex);
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [flattenedSections]);

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

To fix this issue we can add following code here so in case of just heights are recalculated focusedIndex does not change.

useEffect(() => {
const selectedItemIndex = flattenedSections.allOptions.findIndex((option) => option.isSelected);
if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex) {
return;
}
setFocusedIndex(selectedItemIndex);
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [flattenedSections]);

useEffect(() => {
    if (prevAllOptionsLength === flattenedSections.allOptions.length) {
        return;
    }
    const selectedItemIndex = flattenedSections.allOptions.findIndex((option) => option.isSelected);
    if (selectedItemIndex === -1 || selectedItemIndex === focusedIndex) {
        return;
    }
    setFocusedIndex(selectedItemIndex);
    // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [flattenedSections]);

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

@Beamanator
Copy link
Contributor

Thanks for the recommended fix @ishakakkad !

Just so you know, for Deploy Blockers we normally look for the source PR that caused the problem so that the author & C+ of that source PR can write up the fix. From your suggestion, it looks like the PR that introduced that linked useEffect is #54457

@DylanDylann
Copy link
Contributor

@daledah Could you check this issue?

@daledah
Copy link
Contributor

daledah commented Jan 8, 2025

I'll create a follow up PR soon

@Beamanator
Copy link
Contributor

Groovy, assigning you both 🙏

@Beamanator
Copy link
Contributor

@daledah any updates?? Please make this your top priority since it is blocking our next deploy!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Hourly KSv2 labels Jan 8, 2025
@daledah
Copy link
Contributor

daledah commented Jan 8, 2025

@Beamanator @DylanDylann we have open PR here

Copy link

melvin-bot bot commented Jan 8, 2025

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@thienlnam thienlnam removed the DeployBlockerCash This issue or pull request should block deployment label Jan 8, 2025
@melvin-bot melvin-bot bot removed the Weekly KSv2 label Jan 10, 2025
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Jan 10, 2025
@melvin-bot melvin-bot bot changed the title Web - Expense - Unable to navigate to different currency via keyboard [HOLD for payment 2025-01-17] Web - Expense - Unable to navigate to different currency via keyboard Jan 10, 2025
Copy link

melvin-bot bot commented Jan 10, 2025

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 10, 2025
Copy link

melvin-bot bot commented Jan 10, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.82-12 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 2025-01-17. 🎊

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

  • @DylanDylann requires payment (Needs manual offer from BZ)
  • @daledah requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jan 10, 2025

@DylanDylann @twisterdotcom @DylanDylann The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jan 11, 2025
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2025-01-17] Web - Expense - Unable to navigate to different currency via keyboard [HOLD for payment 2025-01-18] [HOLD for payment 2025-01-17] Web - Expense - Unable to navigate to different currency via keyboard Jan 11, 2025
Copy link

melvin-bot bot commented Jan 11, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.83-5 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 2025-01-18. 🎊

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

  • @DylanDylann requires payment (Needs manual offer from BZ)
  • @daledah requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Jan 11, 2025

@DylanDylann @twisterdotcom @DylanDylann The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 16, 2025
@michaelkwardrop
Copy link
Contributor

Hey @twisterdotcom just a heads up this is a regression from #54089

Copy link

melvin-bot bot commented Jan 18, 2025

Payment Summary

Upwork Job

  • ROLE: @DylanDylann paid $(AMOUNT) via Upwork (LINK)
  • ROLE: @daledah paid $(AMOUNT) via Upwork (LINK)

BugZero Checklist (@twisterdotcom)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@melvin-bot melvin-bot bot added the Overdue label Jan 18, 2025
@twisterdotcom
Copy link
Contributor

@Beamanator given it's a regression they fixed, are we good with making this fix $125 too?

This is the deploy blocker regression from the issue referenced: #54089 where @DylanDylann and @daledah have already been reduced to $125. Considering they fixed it, they make up the other $125, as if they hadn't regressed in the first place... right? Makes sense?

@melvin-bot melvin-bot bot removed the Overdue label Jan 20, 2025
@twisterdotcom
Copy link
Contributor

If you agree, I may simply provide a bonus on the original offers: #54089 (comment)

@parasharrajat
Copy link
Member

@twisterdotcom The process is that. It is a regression so that there will not any payment for this issue and the original issue which caused this regression will have deduction.

@DylanDylann
Copy link
Contributor

We can close this one

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 Engineering
Projects
None yet
Development

No branches or pull requests

9 participants