Skip to content

[HOLD for payment 2025-01-18] [$250] Categories - Category list moves with up and down key when RHP Is opened #54587

Closed

Description

@vincdargento

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: v9.0.78-5
Reproducible in staging?: Yes
Reproducible in production?: Yes
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: N/A
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Categories.
  3. Open any category RHP.
  4. Press keyboard up or down key.

Expected Result:

Category list will not move with up and down key when RHP is opened (as in PR #39327)

Actual Result:

Category list moves with up and down key when RHP is opened.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021874222072625755779
  • Upwork Job ID: 1874222072625755779
  • Last Price Increase: 2024-12-31
  • Automatic offers:
    • QichenZhu | Contributor | 105551234
Issue OwnerCurrent Issue Owner: @anmurali

Activity

  1. added
    Daily
    Bug
    on Dec 26, 2024
  2. melvin-bot commented on Dec 26, 2024

    @melvin-bot

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

  3. QichenZhu commented on Dec 27, 2024

    @QichenZhu
    Contributor

    Proposal

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

    The categories list is scrollable with the arrow keys when the RHP is open.

    What is the root cause of that problem?

    In my testing, when using the arrow keys, the browser scrolls the last element the user interacted with. It's not well documented, but I found a Stack Overflow answer https://stackoverflow.com/a/77580408 mentioning this browser behavior.

    When the RHP is not open, useArrowKeyFocusManager prevents the default behavior and controls the scrolling programmatically.

    useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ARROW_UP, arrowUpCallback, arrowConfig);

    shouldPreventDefault = true,

    When the RHP is open, useArrowKeyFocusManager is inactive, so the default behavior resumes.

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

    Always keep useArrowKeyFocusManager active. It will prevent the default behavior but do nothing else when the list is not focused.

    isActive: true,

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

    This issue is caused by the browser's default behavior, so I suggest manual testing in real browsers.

    Also verity this change doesn't reintroduce #41906.

    What alternative solutions did you explore? (Optional)

  4. linhvovan29546 commented on Dec 27, 2024

    @linhvovan29546
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-12-27 04:38:39 UTC.

    Proposal

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

    Categories - Category list moves with up and down key when RHP Is opened

    What is the root cause of that problem?

    This issue stems from default web behavior. When a user clicks on content within a scrollable view, the browser allows scrolling via the keyboard's arrow keys.
    The reason this issue does not appear on other pages as PR #39327, is that those screens use SectionList with useArrowKeyFocusManager to handle keydown events, and when the Category list is not focused this hook is not active

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

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

    Disable scrolling when the Category list is not focused

    <SectionList
    removeClippedSubviews={removeClippedSubviews}
    ref={listRef}

    scrollEnabled={isFocused}
    POC
    Screen.Recording.2024-12-27.at.11.18.13.AM.mov

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

    N/A

    What alternative solutions did you explore? (Optional)

    Override arrow key behavior when RHP(CategorySettingsPage) is opened, we can add useArrowKeyFocusManager hook to CategorySettingsPage page

    function CategorySettingsPage({
    route: {
    params: {backTo, policyID, categoryName},
    },
    navigation,
    }: CategorySettingsPageProps) {

    useArrowKeyFocusManager({
        maxIndex: -1, 
    });
  5. melvin-bot commented on Dec 30, 2024

    @melvin-bot

    @anmurali Whoops! This issue is 2 days overdue. Let's get this updated quick!

  6. added
    External
    on Dec 31, 2024
  7. melvin-bot commented on Dec 31, 2024

    @melvin-bot
  8. changed the title [-]Categories - Category list moves with up and down key when RHP Is opened[/-] [+][$250] Categories - Category list moves with up and down key when RHP Is opened[/+] on Dec 31, 2024
  9. added
    Help Wanted
    on Dec 31, 2024
  10. melvin-bot commented on Dec 31, 2024

    @melvin-bot

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

  11. 17 remaining items

  12. changed the title [-][$250] Categories - Category list moves with up and down key when RHP Is opened[/-] [+][HOLD for payment 2025-01-18] [$250] Categories - Category list moves with up and down key when RHP Is opened[/+] on Jan 11, 2025
  13. removed
    Reviewing
    on Jan 11, 2025
  14. melvin-bot commented on Jan 11, 2025

    @melvin-bot

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

  15. melvin-bot commented on Jan 11, 2025

    @melvin-bot

    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:

  16. melvin-bot commented on Jan 11, 2025

    @melvin-bot

    @jayeshmangwani @anmurali @jayeshmangwani 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]

  17. added
    Daily
    and removed
    Weekly
    on Jan 17, 2025
  18. jayeshmangwani commented on Jan 19, 2025

    @jayeshmangwani
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
  19. melvin-bot commented on Jan 20, 2025

    @melvin-bot

    @iwiznia, @anmurali, @jayeshmangwani, @QichenZhu Whoops! This issue is 2 days overdue. Let's get this updated quick!

  20. anmurali commented on Jan 22, 2025

    @anmurali

    Payment Summary

  21. garrettmknight commented on Feb 11, 2025

    @garrettmknight
    Contributor

    $250 approved for @jayeshmangwani

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions