Skip to content

[Payment Due June 16, 2025] [$250] mWeb - Search - In search, scrolling the page doesn't close the keypad. #61521

Closed

Description

@jponikarchuk

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.1.40-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
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): Slottwo1 sivappa2@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote note 10s android 13 phone
App Component: Chat Report View

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Login account with more chats
  3. Tap search
  4. Scroll the page up and down

Expected Result:

In search, scrolling the page must close the keypad.

Actual Result:

In search, scrolling the page doesn't close the keypad.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021922351372001950494
  • Upwork Job ID: 1922351372001950494
  • Last Price Increase: 2025-05-13
  • Automatic offers:
    • truph01 | Contributor | 107372286
Issue OwnerCurrent Issue Owner: @muttmuure

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 6, 2025
  2. melvin-bot commented on May 6, 2025

    @melvin-bot

    Triggered auto assignment to @muttmuure (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. linhvovan29546 commented on May 7, 2025

    @linhvovan29546
    Contributor

    Proposal

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

    mWeb - Search - In search, scrolling the page doesn't close the keypad.

    What is the root cause of that problem?

    We already have logic to dismiss the keyboard on scroll, which works as expected in other parts of the app.

    const defaultOnScroll = () => {
    // Only dismiss the keyboard whenever the user scrolls the screen
    if (!isScreenTouched) {
    return;
    }
    Keyboard.dismiss();
    };

    However, it doesn’t work in the search screen because the search input is rendered via the SearchAutocompleteInput component.

    Looking deeper, this component uses a TextInput with the type markdown, which on the web renders as a div with contentEditable. As a result, calling Keyboard.dismiss() has no effect in this OP
    https://github.com/Expensify/react-native-live-markdown/blob/main/src/MarkdownTextInput.web.tsx#L772-L775

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

    I think we can fix this by manually blur the input instead of relying on Keyboard.dismiss(). Here's the approach:

    • Introduce a new props dismissExternalKeyboard in the SelectionList component.
    • In the defaultOnScroll handler, call dismissExternalKeyboard() to hide the keyboard.
      const defaultOnScroll = () => {
      // Only dismiss the keyboard whenever the user scrolls the screen
      if (!isScreenTouched) {
      return;
      }
      Keyboard.dismiss();
      };
        const defaultOnScroll = () => {
            // Only dismiss the keyboard whenever the user scrolls the screen
            if (!isScreenTouched) {
                return;
            }
            if(dismissExternalKeyboard){
                dismissExternalKeyboard();
                return
            }
            Keyboard.dismiss();
        };
    const dismissExternalKeyboard = () => {
        textInputRef?.current?.blur();
    }; 
    ...
                <SelectionList<OptionData | SearchQueryItem>
                    dismissExternalKeyboard={dismissExternalKeyboard}
                    ...
                            textInputRef={textInputRef}

    Note: We should also check other components like SearchPageHeaderInput and apply the same solution

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

    Since this is a keyboard interaction issue specific to web behavior, automated testing isn't necessary in this case.

    What alternative solutions did you explore? (Optional)

  4. truph01 commented on May 9, 2025

    @truph01
    Contributor

    Proposal

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

    • When using search, scrolling the page does not dismiss the on-screen keyboard.

    What is the root cause of that problem?

    
    var dismissKeyboard = () => {
      TextInputState.blurTextInput(TextInputState.currentlyFocusedField());
    };
    

    See: https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/dismissKeyboard/index.js

    
    TextInputState._currentlyFocusedNode = hostNode;
    
    • However, for <div contenteditable="true" />, TextInputState.currentlyFocusedField() returns null because there is no logic to update TextInputState._currentlyFocusedNode in this case. This is the root cause of the bug.

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

    To resolve this, we need to ensure that TextInputState._currentlyFocusedNode is also updated for <div contenteditable="true" /> elements. This requires two steps:

    Step 1: Export TextInputState from react-native-web so it can be used externally.

    Update this logic:
    https://github.com/necolas/react-native-web/blob/922c134f2b7c428cc19daaeb3cac4b6a4c8ec6a3/packages/react-native-web/src/exports/NativeModules/index.js#L10-L15

    From:

    
    import UIManager from '../UIManager';
    
    // NativeModules shim
    const NativeModules = {
      UIManager
    };
    

    To:

    
    import UIManager from '../UIManager';
    import TextInputState from '../../modules/TextInputState';
    
    // NativeModules shim
    const NativeModules = {
      UIManager,
      TextInputState
    };
    

    Step 2: Update the TextInputState._currentlyFocusedNode when the contenteditable div receives focus.

    Modify the logic here:
    https://github.com/Expensify/react-native-live-markdown/blob/0a5c7736d876ad11762aa88c736c1c9b860eedc7/src/MarkdownTextInput.web.tsx#L552-L553

    From:

    
    const handleFocus = useCallback(event => {
    

    To:

    
    const handleFocus = useCallback(event => {
      NativeModules.TextInputState._currentlyFocusedNode = hostNode;
    

    What alternative solutions did you explore? (Optional)

    • After implementing Step 1, another option is to update TextInputState._currentlyFocusedNode directly within the Expensify app instead of react-native-live-markdown. For example, update:
      <AnimatedMarkdownTextInput

    To:

    
    <AnimatedMarkdownTextInput
        onFocus={(e) => {
            props?.onFocus?.(e);
            NativeModules.TextInputState._currentlyFocusedNode = e.target;
        }}
    />
    
  5. melvin-bot commented on May 12, 2025

    @melvin-bot

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

  6. moved this to Bugs and Follow Up Issues in #expensify-bugson May 13, 2025
  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 13, 2025
  8. changed the title [-]mWeb - Search - In search, scrolling the page doesn't close the keypad.[/-] [+][$250] mWeb - Search - In search, scrolling the page doesn't close the keypad.[/+] on May 13, 2025
  9. melvin-bot commented on May 13, 2025

    @melvin-bot
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 13, 2025
  11. 36 remaining items

  12. melvin-bot commented on Jun 20, 2025

    @melvin-bot

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

  13. muttmuure commented on Jun 22, 2025

    @muttmuure
    Contributor

    $250 - @parasharrajat C+
    $250 - @truph01 C

  14. parasharrajat commented on Jun 24, 2025

    @parasharrajat
    Member

    @muttmuure @truph01 needs to be paid via Upwork. Can you please confirm whether they are paid? If so, let's close this issue. I will request later.

  15. muttmuure commented on Jun 25, 2025

    @muttmuure
    Contributor

    @truph01 has been paid in Upwork

  16. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Jun 25, 2025
  17. parasharrajat commented on Jul 28, 2025

    @parasharrajat
    Member

    Payment requested as per #61521 (comment)

  18. twisterdotcom commented on Jul 31, 2025

    @twisterdotcom
    Contributor

    @parasharrajat has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-0f1f-a8d8-beaf-08d15ddcf211
  19. truph01 commented on Dec 30, 2025

    @truph01
    Contributor

    @muttmuure You mentioned here that I had been paid (#61521 (comment)), but I haven’t actually received any payment via Upwork yet.

    Could you please help double-check this?

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions