Skip to content

[C+ Checklist Needs Completion] [$250] [Search v2.5] - Unable to perform search by hitting Enter on search bar when expense is selected #51427

Closed

Description

@lanitochka17

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.53-1
Reproducible in staging?: Y
Reproducible in production?: Y
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): applausetester+kh1610015@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Search
  3. Click Filters
  4. Apply any filter that will return results
  5. Select an expense via checkbox
  6. Click on the search input field
  7. Type anything and hit Enter

Expected Result:

App will perform a new search

Actual Result:

The dropdown button is expanded

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence
Bug6644670_1729784811459.20241024_234027.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021854660565820716226
  • Upwork Job ID: 1854660565820716226
  • Last Price Increase: 2024-11-07
  • Automatic offers:
    • Krishna2323 | Contributor | 104870980
Issue OwnerCurrent Issue Owner: @eh2077

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 24, 2024
  2. melvin-bot commented on Oct 24, 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. lanitochka17 commented on Oct 24, 2024

    @lanitochka17
    Author

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

  4. Krishna2323 commented on Oct 24, 2024

    @Krishna2323
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-10-24 19:31:51 UTC.

    Proposal


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

    Search - Unable to perform search by hitting Enter on search bar when expense is selected

    What is the root cause of that problem?

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


    We have several options to solve this.

    • We can remove the pressOnEnter prop.
    • We can use useActiveElementRole and pass false to pressOnEnter when activeElementRole is presentation.
        const activeElementRole = useActiveElementRole();
        const disableEnterShortcut = activeElementRole && [CONST.ROLE.PRESENTATION].includes(activeElementRole as 'presentation');
    • Through ref forwarding, we can get the input ref of the input in SearchRouterInput and then we can use textInputRef.current?.isFocused() to disabled the pressOnEnter prop. We might also need to use useEffect to keep the updated value of textInputRef.current?.isFocused().
    • If needed, we can also remove pressOnEnter prop from other pages like workspace categories, tags, etc.

    What alternative solutions did you explore? (Optional)

    • In the useKeyboardShortcut config we can add captureOnInputs: false.
      const config = useMemo(
      () => ({
      isActive: pressOnEnter && !shouldDisableEnterShortcut && (isFocused || isPressOnEnterActive),
      shouldBubble: allowBubble,
      priority: enterKeyEventListenerPriority,
      shouldPreventDefault: false,
      }),
      // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
      [shouldDisableEnterShortcut, isFocused],
      );
    • Or we can introduce a new prop captureOnInputs and then pass it from SearchPageHeader > ButtonWithDropdownMenu > Button.
    • Else we can make the default value false.
      captureOnInputs = true,

    Result

  5. FitseTLT commented on Oct 24, 2024

    @FitseTLT
    Contributor

    Proposal

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

    Search - Unable to perform search by hitting Enter on search bar when expense is selected

    What is the root cause of that problem?

    We have set pressOnEnter on the drop down button and in side the button we already have a code that disable the shortcut based on the active element role but it only disables it if the active element is presentation, which is correct

    const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ROLE.PRESENTATION, [activeElementRole]);

    but we set our text inputs role as presentation
    role={CONST.ROLE.PRESENTATION}

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

    I propose two options

    1. We can give the text input a proper role like textbox
      We will need to add the role here
            TEXTBOX: 'textbox',
    
    
    1. Along with active role element management we can keep track of whether a text input is focused. Here
      const [activeRoleRef, setRole] = useState<string | null>(document?.activeElement?.role ?? null);
      const handleFocusIn = () => {
    const [isTextInputFocused, setIsTextInputFocused] = useState<boolean | null>(null);
        const handleFocusIn = () => {
            setRole(document?.activeElement?.role ?? null);
            setIsTextInputFocused(['INPUT', 'TEXTAREA'].includes(document.activeElement?.nodeName ?? ''));
        };
    
    ....
    
    
        const value = React.useMemo(
            () => ({
                role: activeRoleRef,
                isTextInputFocused,
            }),
            [activeRoleRef, isTextInputFocused],
    

    then

    const useIsTextInputFocused = () => {
        const {isTextInputFocused} = useContext(ActiveElementRoleContext);
        return isTextInputFocused;
    };
    

    const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ROLE.PRESENTATION, [activeElementRole]);

    const isTextInputFocused = useIsTextInputFocused();
        const shouldDisableEnterShortcut = useMemo(
            () => isTextInputFocused || (accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ROLE.PRESENTATION),
            [activeElementRole, isTextInputFocused],
        );
    

    What alternative solutions did you explore? (Optional)

  6. Krishna2323 commented on Oct 24, 2024

    @Krishna2323
    Contributor

    PROPOSAL UPDATED

    • Added alternative solution
  7. melvin-bot commented on Oct 29, 2024

    @melvin-bot

    @anmurali Eep! 4 days overdue now. Issues have feelings too...

  8. anmurali commented on Oct 29, 2024

    @anmurali

    I don't think it's very clear how this should behave. You are changing the filter criteria, but there is a selected expense. Should the filter results update? What if the selected expense no longer matches the criteria? cc @luacmartins @trjExpensify @JmillsExpensify

  9. self-assigned this
    on Oct 29, 2024
  10. luacmartins commented on Nov 4, 2024

    @luacmartins
    Contributor

    I imagine we'd just clear the selection and perform the new Search. cc @JmillsExpensify for your input as well.

  11. 40 remaining items

  12. melvin-bot commented on Nov 15, 2024

    @melvin-bot

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

  13. melvin-bot commented on Nov 15, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.62-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-11-22. 🎊

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

  14. melvin-bot commented on Nov 15, 2024

    @melvin-bot

    @eh2077 @greg-schroeder @eh2077 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]

  15. moved this from Bugs and Follow Up Issues to Hold for Payment in #expensify-bugson Nov 19, 2024
  16. greg-schroeder commented on Nov 21, 2024

    @greg-schroeder
    Contributor

    Payment summary:

    Contributor: @Krishna2323 - $250 - Upwork
    C+: @eh2077 - $250 - Paid via NewDot manual request


    Next up @eh2077 can you complete the checklist? Thank you!

  17. changed the title [-][HOLD for payment 2024-11-22] [$250] [Search v2.5] - Unable to perform search by hitting Enter on search bar when expense is selected[/-] [+][C+ Checklist Needs Completion] [$250] [Search v2.5] - Unable to perform search by hitting Enter on search bar when expense is selected[/+] on Nov 21, 2024
  18. eh2077 commented on Nov 24, 2024

    @eh2077
    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
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on both staging and production
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: https://github.com/Expensify/App/pull/49462/files#r1855460915

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    N/A

    Test:

    1. Go to Search
    2. Click Filters
    3. Apply any filter that will return results
    4. Select an expense via checkbox
    5. Click on the search input field
    6. Type anything and hit Enter
    7. Verify search is submitted

    Do we agree 👍 or 👎

  19. luacmartins commented on Nov 25, 2024

    @luacmartins
    Contributor

    We're adding tests as part of the project wrap up, so no need to do that now,

  20. greg-schroeder commented on Nov 26, 2024

    @greg-schroeder
    Contributor

    Okay, thanks @luacmartins

  21. moved this from Hold for Payment to Done in #expensify-bugson Nov 26, 2024
  22. eh2077 commented on Nov 26, 2024

    @eh2077
    Contributor

    Requested payment in NewDot

  23. JmillsExpensify commented on Nov 27, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @eh2077

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions