Skip to content

Fix keyboard doesn't show up when returning from Help Page to the Status Page#69265

Closed
rohit9625 wants to merge 18 commits into
Expensify:mainfrom
rohit9625:fix/keyboard-not-open
Closed

Fix keyboard doesn't show up when returning from Help Page to the Status Page#69265
rohit9625 wants to merge 18 commits into
Expensify:mainfrom
rohit9625:fix/keyboard-not-open

Conversation

@rohit9625

@rohit9625 rohit9625 commented Aug 26, 2025

Copy link
Copy Markdown
Contributor

Explanation of Change

I created a patch for the React Native TextInput component, which shows the Android's software keyboard reliably by delaying IME request until the View containing the TextInput gains focus. This strategy is inspired by official Android docs.

Fixed Issues

$ #67201
PROPOSAL: $ #67201 (comment)

Tests

Precondition: Ensure that the help page is enabled on your account. If it is not enabled, you can enable it by running Onyx.set('nvp_sidePanel', { open: true }) in the console.

  1. Launch Expensify app.
  2. Go to Account.
  3. Tap Status icon.
  4. Tap on the input field if not focused.
  5. Tap help icon.
  6. Tap app back button.
  7. Ensure the keyboard will reopen
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests
// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2025-09-13.at.7.28.46.PM.mov
Android: mWeb Chrome
Screen.Recording.2025-09-13.at.7.32.48.PM.mov
iOS: Native
Screen.Recording.2025-09-13.at.7.17.32.PM.mov
iOS: mWeb Safari
Screen.Recording.2025-09-13.at.7.24.21.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2025-09-13.at.6.39.06.PM.mov
MacOS: Desktop
Screen.Recording.2025-09-13.at.6.43.06.PM.mov

@rohit9625 rohit9625 changed the title fix: set focus timeout for isScreenTransitionEnded after interactions… Fix keyboard doesn't show up when returning from Help Page to the Status Page Aug 26, 2025
@linhvovan29546

linhvovan29546 commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

@rohit9625 Did you try building the Android app locally? I think we can build it in release mode, but we need to generate a keystore local.

@rohit9625

Copy link
Copy Markdown
Contributor Author

Yes, I tried this when working on previous PR. I used debug.keystore to sign and generate APK but I wasn't able to reproduce the issue even without our fix.

@rohit9625

Copy link
Copy Markdown
Contributor Author

HI @linhvovan29546, can we start the Adhoc build here or we require any other changes?

@linhvovan29546

Copy link
Copy Markdown
Contributor

I'm just wondering why we didn't apply the fix for shouldHideSidePanel as we did in the previous PR?

@rohit9625

Copy link
Copy Markdown
Contributor Author

I'm just wondering why we didn't apply the fix for shouldHideSidePanel as we did in the previous PR?

It's just one of the solutions that we dicovered. I thought we should add InteractionManager for the useFocusEffect as I experienced that useFocusEffect executed before useEffect. So, I think we should give it a try if this doesn't work we can add InteractionManager for the useEffect where we added Promise.all last time. Let me know your thoughts!

@linhvovan29546

Copy link
Copy Markdown
Contributor

We had InteractionManager in the focus, so i think that might not work

@rohit9625

Copy link
Copy Markdown
Contributor Author

Yes, I also thoght about that. Let me try logging and verify which block of code is executing first. Just give 10 mins.

@rohit9625

rohit9625 commented Aug 27, 2025

Copy link
Copy Markdown
Contributor Author

Yes, you are right @linhvovan29546. My current solution will not work as useFocusEffect is only executed when we arrive at StatusPage and not when closing SidePanel. I am adding InteractionManager there :)

@rohit9625

rohit9625 commented Aug 27, 2025

Copy link
Copy Markdown
Contributor Author

Are we good to go with Adhoc build, @linhvovan29546, or should I complete the checklist first to make the PR ready to review?

@linhvovan29546

linhvovan29546 commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

I mean we had InteractionManager when we call textInput focus. Could you tried with the solution similar the logic in the composerFocusWithDelay first?

@rohit9625

Copy link
Copy Markdown
Contributor Author

I mean we had InteractionManager when we call textInput focus. Could you tried with the solution similar the logic in the composerFocusWithDelay first?

Why similar logic if we can directly call focusComposerAfterDelay? However, I'm afraid that will also impact other usages of useAutoFocus.
But yes, we can add the same 150 ms delay here:

Promise.all([ComposerFocusManager.isReadyToFocus(), isWindowReadyToFocus()]).then(() => setIsScreenTransitionEnded(isSidePanelTransitionEnded));

I think this is what you meant, right?

@linhvovan29546

Copy link
Copy Markdown
Contributor

Yes, We only need to apply for android

@rohit9625

Copy link
Copy Markdown
Contributor Author

Yes, We only need to apply for android

Well, it makes sense, but I think it will make the focus timing inconsistent for Android and other platforms. Should we really do that, as focusComposeWithDelay was created for all platforms?

@linhvovan29546

Copy link
Copy Markdown
Contributor

Yes, We only need to apply for android

Well, it makes sense, but I think it will make the focus timing inconsistent for Android and other platforms. Should we really do that, as focusComposeWithDelay was created for all platforms?

Yes, that makes sense since the issue only appears on the Android hybrid app. Let's wait for QA to confirm, and meanwhile, I'll try to build the hybrid app locally

@linhvovan29546

Copy link
Copy Markdown
Contributor

QA confirmed the issue still exist in the previous PR

@rohit9625

rohit9625 commented Aug 28, 2025

Copy link
Copy Markdown
Contributor Author

Yes, I saw the deploy checklist. But I have a doubt, why did the solution deployed to the production if it doesn't solve the problem?

@linhvovan29546

Copy link
Copy Markdown
Contributor

That is not deloy blocker.

@rohit9625

Copy link
Copy Markdown
Contributor Author

Okay, got it. So, now I am creating the android only delay function.

@linhvovan29546

Copy link
Copy Markdown
Contributor

I still reproduce after apply the timeout 150ms

@rohit9625

Copy link
Copy Markdown
Contributor Author

Oh!
Now that's a serious problem. This wasn't supposed to happen after a 150ms delay. Can you see a noticeable difference after applying delay?

@linhvovan29546

Copy link
Copy Markdown
Contributor

Could you try push the code, so i can test this

@rohit9625

rohit9625 commented Aug 28, 2025

Copy link
Copy Markdown
Contributor Author

Hi @linhvovan29546, today I found that focusComposeAfterDelay was a workaround for this problem:

So, I thought about fixing this problem in upstream, and I created a patch inspired by Android's official documentation:

I'll push the patch and I think it should fix the issue. Let me know what you think about it.

@linhvovan29546

Copy link
Copy Markdown
Contributor

You can login same account on web and run that console

@rohit9625

Copy link
Copy Markdown
Contributor Author

Thanks @linhvovan29546, it worked. I tested the Adhoc build, and the issue is resolved for me now. Did you try that?

Screen_recording_20250913_113336.mp4

I'll be completing the Author Checklist now and modifying the patch markdown to resolve the Validate Patches task failure.

@linhvovan29546

Copy link
Copy Markdown
Contributor

Let me check first and I'll update soon.

@linhvovan29546

Copy link
Copy Markdown
Contributor

You can login same account on web and run that console

Hmm, the help button is displayed on my account on the web, but it does not appear on the adhoc build.

@rohit9625

Copy link
Copy Markdown
Contributor Author

Try signing out and login again on app.

@linhvovan29546

linhvovan29546 commented Sep 13, 2025

Copy link
Copy Markdown
Contributor

I can't reproduce the issue on the adhoc build, and the changes LGTM. I've posted in Slack to get more eyes on this

@rohit9625

Copy link
Copy Markdown
Contributor Author

That's great, I'm filling the author checklist now :)

Also, renamed patch file to follow sequence of files.
@rohit9625 rohit9625 marked this pull request as ready for review September 13, 2025 14:31
@rohit9625

Copy link
Copy Markdown
Contributor Author

It's ready to review, @linhvovan29546

@rohit9625

Copy link
Copy Markdown
Contributor Author

Friendly bump! @linhvovan29546
Are we close to approving this PR from your side?

@linhvovan29546

Copy link
Copy Markdown
Contributor

Hi i still need to confirm with the expert contributors

@rohit9625

rohit9625 commented Sep 15, 2025

Copy link
Copy Markdown
Contributor Author

Okay, then I'll wait. Why can't I access the Slack thread link you sent before? It always asks me to sign in using G-Suite. Did you posted that on internal channel?

@linhvovan29546

Copy link
Copy Markdown
Contributor

Hi, I will complete the checklist tomorrow

@linhvovan29546

Copy link
Copy Markdown
Contributor

Ah, the other PR was reverted, so we need to wait for it to be merged again first :))

@rohit9625

Copy link
Copy Markdown
Contributor Author

Hi @linhvovan29546,
The side panel has been removed from the app temporarily. Therefore, we can't test the changes, and the side panel will not be restored soon, as it looks like from this comment.
What should we do now? This PR has been on hold for so long.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@rohit9625 Do you have any steps to reproduce this issue without using the Help page?

@rohit9625

Copy link
Copy Markdown
Contributor Author

@rohit9625 Do you have any steps to reproduce this issue without using the Help page?

I have to check with other screens where such animation is affecting TextInput's focus behavior. However, we do have some workarounds for the same issue on different screens. If you agree, we can remove those workarounds(some may be a few lines of code only) and test without our patch if the same issue exists and then apply the patch and verify if our solution fixes that issue.

@linhvovan29546

Copy link
Copy Markdown
Contributor

I don't think we should remove that, as it could cause regressions on other platforms as well. If we can't reproduce this issue without the Help page, I think we can close it and I will request compensation for the work

@rohit9625

Copy link
Copy Markdown
Contributor Author

Yeah, makes sense. But I'm strongly confident that the patch will definitely help avoid workarounds in the future. This is also true, that it can cause regressions. Let me know when to close this PR. Well, how much compensation can we get?

@linhvovan29546

Copy link
Copy Markdown
Contributor

If we can't reproduce this issue without the Help page

@rohit9625 I tried to reproduce the issue, but it didn't occur. Are you still able to reproduce it without the Help page?

@rohit9625

Copy link
Copy Markdown
Contributor Author

No @linhvovan29546, I also can't reproduce the issue anywhere in the app. I think closing this PR would be fine.

@rohit9625

Copy link
Copy Markdown
Contributor Author

Hi @linhvovan29546, what did you decided about this?

@rohit9625

Copy link
Copy Markdown
Contributor Author

Closing PR as the issue is no longer reproducible.

@rohit9625 rohit9625 closed this Oct 3, 2025
@rohit9625 rohit9625 deleted the fix/keyboard-not-open branch March 5, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants