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-01-17] [$500] Category & Tag - Unable to select Category/Tag with Enter key when there is less than 8 items #33764

Closed
2 of 6 tasks
kbecciv opened this issue Dec 29, 2023 · 17 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 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Dec 29, 2023

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: v1.4.19-1
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal team
Slack conversation:

Action Performed:

Precondition:

  • User is an employee of a Collect workspace.
  • The Collect workspace has less than 8 items for both Category and Tag.
  1. Go to workspace chat as employee.
  2. Click + > Request money > Manual.
  3. Enter amount > Next > Show more.
  4. Click Category.
  5. Hit Enter.
  6. Return to confirmation page.
  7. Click Tag.
  8. Hit Enter.

Expected Result:

User is able to select category/tag by hitting Enter on the selection.

Actual Result:

Nothing happens when hitting Enter on the selected category/tag.

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

Bug6328526_1703868072131.20231229_210214.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f16a13cdec4a4762
  • Upwork Job ID: 1740788160854630400
  • Last Price Increase: 2023-12-29
  • Automatic offers:
    • s77rt | Reviewer | 28073778
    • FitseTLT | Contributor | 28073779
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 29, 2023
@melvin-bot melvin-bot bot changed the title Category & Tag - Unable to select Category/Tag with Enter key when there is less than 8 items [$500] Category & Tag - Unable to select Category/Tag with Enter key when there is less than 8 items Dec 29, 2023
Copy link

melvin-bot bot commented Dec 29, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01f16a13cdec4a4762

Copy link

melvin-bot bot commented Dec 29, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 29, 2023
Copy link

melvin-bot bot commented Dec 29, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Dec 29, 2023

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

@FitseTLT
Copy link
Contributor

FitseTLT commented Dec 29, 2023

Proposal

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

Unable to select Category/Tag with Enter key when there is less than 8 items

What is the root cause of that problem?

When there is more than 8 items the selection via enter key will occur through onSubmitEditing of the text input in BaseOptionsSelector

onSubmitEditing={this.selectFocusedOption}

But for lesser items the enter key event listener here should have handled it
const enterConfig = CONST.KEYBOARD_SHORTCUTS.ENTER;
this.unsubscribeEnter = KeyboardShortcut.subscribe(
enterConfig.shortcutKey,
this.selectFocusedOption,
enterConfig.descriptionKey,
enterConfig.modifiers,
true,
() => !this.state.allOptions[this.state.focusedIndex],
);

but the event gets consumed by the Request button in confirmation page below the picker page (and also the button of the participants page if you come from the main FAB flow) over the enter key listener in BaseOptionsSelector for the category/tag picker so it is not selecting the focused item.
Although the BaseOptionsSelector should have consumed the event first as it is subscribe the latest from both buttons, the event subscriber for the button re-subscribes as the activeElement changes as it subscribes using useKeyboardShortcut hook with as isActive is dependent on useActiveElement here

const activeElement = useActiveElement();
const accessibilityRoles: string[] = Object.values(CONST.ACCESSIBILITY_ROLE);

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

  1. Now the buttons that are consuming the enter key event are in pages below category picker page, which means the buttons are consuming the event although the page they are in is not in focus. However that is wrong and this will create problems everywhere we use button with pressOnEnter and we should apply the fix in Button so that it will only consume the enter key event only if it is focused so change this
    isActive: pressOnEnter && !shouldDisableEnterShortcut,
    shouldBubble: allowBubble,

    to
        isActive: pressOnEnter && !shouldDisableEnterShortcut && isFocused,

const activeElement = useActiveElement();
const accessibilityRoles: string[] = Object.values(CONST.ACCESSIBILITY_ROLE);

What alternative solutions did you explore? (Optional)

Ofcourse we can use many other alternative solutions so that the enter key event triggers the listener in BaseOptionsSelector like

  1. using priority
    The enter key listener in BaseOptionsSelector should have a higher priority (N.B the priority value should be lesser to have high priority) than the Request button in confirmation page,
    So we will give the button less priority here
    <ButtonWithDropdownMenu
    pressOnEnter
    isDisabled={shouldDisableButton}
    onPress={(_event, value) => confirm(value)}
    options={splitOrRequestOptions}
    buttonSize={CONST.DROPDOWN_BUTTON_SIZE.LARGE}
    />

    we will create a new priority prop for ButtonWithDropdownMenu and pass it to the Button in the component and do the same for the participant button too.
  2. Or there is an already disabling enter mechanism which disables if the active element has a role different from text so we can give the list items a role that can also disable the enter key listener in the button

@s77rt
Copy link
Contributor

s77rt commented Dec 30, 2023

@FitseTLT Thanks for the proposal. Your RCA is correct. The useKeyboardShortcut hook will re-run in many cases and since we can't prevent it from re-running (e.g. the keyboardShortcutCallback can change if the onPress changes) the best option here is to unsubscribe on re-run instead of subscribing again (just as you suggested). I would just add that we should remove the isFocused param from validateSubmitShortcut since it will never be false. Great solution overall 👍

🎀 👀 🎀 C+ reviewed
Link to proposal

Copy link

melvin-bot bot commented Dec 30, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 30, 2023
Copy link

melvin-bot bot commented Dec 30, 2023

📣 @s77rt 🎉 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 Dec 30, 2023

📣 @FitseTLT 🎉 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 the Overdue label Jan 1, 2024
@jliexpensify
Copy link
Contributor

@nkuoch does this need to be added to the Wave 6 project? Cheers!

@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Jan 10, 2024
@melvin-bot melvin-bot bot changed the title [$500] Category & Tag - Unable to select Category/Tag with Enter key when there is less than 8 items [HOLD for payment 2024-01-17] [$500] Category & Tag - Unable to select Category/Tag with Enter key when there is less than 8 items Jan 10, 2024
Copy link

melvin-bot bot commented Jan 10, 2024

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, 2024
Copy link

melvin-bot bot commented Jan 10, 2024

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

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

Copy link

melvin-bot bot commented Jan 10, 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:

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

@s77rt
Copy link
Contributor

s77rt commented Jan 12, 2024


Regression Test Proposal

  1. Open App
  2. Go to any workspace chat as an employee
  3. Click + > Request money > Manual
  4. Enter amount > Next > Show more
  5. Click Category
  6. Click anywhere so the Search input is not focused
  7. Use arrow keys to select a category
  8. Press Enter
  9. Verify the category got selected

@jliexpensify
Copy link
Contributor

Payment Summary:

Upwork job

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jan 16, 2024
@jliexpensify
Copy link
Contributor

Whoops I am sorry - paying now!

@melvin-bot melvin-bot bot removed the Overdue label Jan 19, 2024
@jliexpensify
Copy link
Contributor

Paid and job closed!

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 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Development

No branches or pull requests

5 participants