Skip to content

[$250] Thread - The compose box is not focused after starting a thread #58874

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

Closed
3 of 8 tasks
mitarachim opened this issue Mar 21, 2025 · 15 comments
Closed
3 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@mitarachim
Copy link

mitarachim commented Mar 21, 2025

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: 9.1.16-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
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
Device used: iPhone 13 / 18.3.2
App Component: Chat Report View

Action Performed:

  1. Open the app or navigate to https://staging.new.expensify.com
  2. Navigate to a 1:1 conversation
    3.Start a thread in an owned message

Expected Result:

The compose box is focused after starting a thread

Actual Result:

The compose box is not focused after starting a thread

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6777503_1742513865978.ScreenRecording_03-20-2025_18-33-59_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021903068815363671624
  • Upwork Job ID: 1903068815363671624
  • Last Price Increase: 2025-03-21
Issue OwnerCurrent Issue Owner: @s77rt
@mitarachim mitarachim added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Mar 21, 2025
Copy link

melvin-bot bot commented Mar 21, 2025

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

@daledah
Copy link
Contributor

daledah commented Mar 21, 2025

Proposal

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

The compose box is not focused after starting a thread

What is the root cause of that problem?

The logic to focus the composer automatically is in

const shouldAutoFocus = shouldFocusInputOnScreenFocus && !modal?.isVisible && shouldShowComposeInput && areAllModalsHidden() && isFocused && !didHideComposerInput;

and shouldFocusInputOnScreenFocus is false for small screen.

We don't have the logic to focus after user starting a thread

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

We should add the condition to check if they want to start the thread. That means it's the empty thread

    const isEmptyThread = isThread(report) && isEmptyReport(report)
    const shouldAutoFocus = (shouldFocusInputOnScreenFocus || isEmptyThread) && !modal?.isVisible && shouldShowComposeInput && areAllModalsHidden() && isFocused && !didHideComposerInput;

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

None

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Mar 21, 2025
@melvin-bot melvin-bot bot changed the title Thread - The compose box is not focused after starting a thread [$250] Thread - The compose box is not focused after starting a thread Mar 21, 2025
Copy link

melvin-bot bot commented Mar 21, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 21, 2025
Copy link

melvin-bot bot commented Mar 21, 2025

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

@s77rt
Copy link
Contributor

s77rt commented Mar 21, 2025

This is not a bug, that's expected. @NicMendonca Can we close this?

@daledah
Copy link
Contributor

daledah commented Mar 22, 2025

Why do you think it's expected? When we start a thread, that means we want to reply, so opening the keyboard looks right cc @NicMendonca

@s77rt
Copy link
Contributor

s77rt commented Mar 23, 2025

@daledah Same thing when you open a chat with any user we don't show up the keyboard. Maybe we should check with the QA team why this is reported (e.g. check if it was caught as part of a regression test)

@daledah
Copy link
Contributor

daledah commented Mar 24, 2025

Same thing when you open a chat with any user we don't show up the keyboard

IMO, when open the chat on small screen, the users may want to read the message only so always showing the keyboard doesn't necessary. But in this case after reply in a thread, the user actually want to type something so opening the keyboard makes more sense. Please let me know your idea @NicMendonca

@FitseTLT
Copy link
Contributor

FitseTLT commented Mar 24, 2025

Proposal

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

Thread - The compose box is not focused after starting a thread

What is the root cause of that problem?

autoFocus will be false because and shouldFocusInputOnScreenFocus is false for small screen (canUseTouchScreen)

const shouldAutoFocus = shouldFocusInputOnScreenFocus && !modal?.isVisible && shouldShowComposeInput && areAllModalsHidden() && isFocused && !didHideComposerInput;

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

We initially used to auto focus for mobile if the report is empty chat report but not transaction thread

const resetKeyboardInput = useCallback(() => {
if (!RNTextInputReset) {
return;
}
RNTextInputReset.resetKeyboardInput(findNodeHandle(textInputRef.current));
}, [textInputRef]);

This is because we normally don't auto focus for mobile to avoid keyboard opening disturbing user experience but if the report is empty there is nothing to see unless it is transaction thread so we auto-focus.
But in here we removed (shouldFocusInputOnScreenFocus || (isEmptyChat && !ReportActionsUtils.isTransactionThread(parentReportAction))) && to auto focus but only avoid the keyboard opening
But another problem arose and we readded shouldFocusInputOnScreenFocus condition in here to avoid auto focus on mobile So in the process we lost the important condition || (isEmptyChat && !ReportActionsUtils.isTransactionThread(parentReportAction)).
Therefor we should re-apply it

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)

@s77rt
Copy link
Contributor

s77rt commented Mar 25, 2025

@jayeshmangwani
Copy link
Contributor

This is intended behavior. We are intentionally not opening the keyboard under any condition. Tagging the @Expensify/design team for their input.

@shawnborton
Copy link
Contributor

That is indeed correct, I think we can close.

I could see an argument that if you are going to start a thread, you might want the compose box immediately focused but I don't feel too strongly - I think this is a case where I would prefer consistency and that we don't auto focus. Let's see what the other designers think though!

@FitseTLT
Copy link
Contributor

@shawnborton What about our previous logic of autoFocusing for empty chats which is:

We normally don't auto focus for mobile to avoid keyboard opening disturbing user experience but if the report is empty there is nothing to see unless it is transaction thread so the user likely opened the chat to compose a message so we auto-focus.

@dannymcclain
Copy link
Contributor

I would prefer to never autofocus—even when starting a new chat/thread.

@shawnborton
Copy link
Contributor

Okay cool, I say we close then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Status: Done
Development

No branches or pull requests

8 participants