You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Not able to focus on main composer while edit composer is open #79769
Version Number: v9.3.2-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@aimane-chnaif Slack conversation (hyperlinked to channel name):
Action Performed:
Go to any chat and send any message
Focus on composer
Press Up Arrow to edit message
Switch to another chat and come back
Focus on edit composer
Focus on main composer
Expected Result:
Main composer should be focused
Actual Result:
Main composer is focused briefly, and then edit composer is focused back
Workaround:
Close edit composer to be able to focus back on main composer
Platforms:
Select the officially supported platforms where the issue was reproduced:
Please re-state the problem that we are trying to solve in this issue.
When the edit composer is open, the user can’t reliably focus the main composer. The main composer receives focus briefly, then focus snaps back to the edit composer—especially after switching chats and returning.
What is the root cause of that problem?
Our focus-management behavior includes automatic refocusing intended to keep editing stable (e.g., restoring the last focused composer / maintaining edit state across navigation). In this scenario, that auto-refocus logic can run after the user explicitly focuses the main composer, causing the edit composer to steal focus back.
Concretely, a delayed “restore focus” (triggered by blur/navigation/interaction completion) doesn’t distinguish between:
“Edit composer lost focus unintentionally, restore it”
“User intentionally focused a different input (main composer), do not override”
What changes do you think we should make in order to solve the problem?
Update composer focus restoration logic to be non-invasive:
If another text input is already focused (e.g., the main composer), do not refocus the edit composer.
If a delayed refocus is scheduled, re-check what is currently focused right before applying focus, and cancel if focus has moved elsewhere.
Ensure the “last focused composer should regain focus” rule only applies when focus was lost due to non-user-intentional causes (e.g., transient UI events), not when the user explicitly taps/focuses the main composer.
if (!isFocused && !onyxFocused && !modal.willAlertModalBecomeVisible && !modal.isVisible && refSave) {
const activeElement = DomUtils.getActiveElement();
const isAnotherTextInputFocused =
!!activeElement && activeElement !== refSave && (activeElement.nodeName === 'INPUT' || activeElement.nodeName === 'TEXTAREA');
if (isAnotherTextInputFocused) {
refSave = undefined;
return;
}
// Focusing will fail when it is called immediately after closing modal so we call it after interaction.
// eslint-disable-next-line @typescript-eslint/no-deprecated
InteractionManager.runAfterInteractions(() => {
// Re-check after interactions: focus may have moved to another input by the time this runs.
if (ReportActionComposeFocusManager.isFocused()) {
refSave = undefined;
return;
}
const currentActiveElement = DomUtils.getActiveElement();
const isTextInputCurrentlyFocused =
!!currentActiveElement && currentActiveElement !== refSave && (currentActiveElement.nodeName === 'INPUT' || currentActiveElement.nodeName === 'TEXTAREA');
if (isTextInputCurrentlyFocused) {
refSave = undefined;
return;
}
refSave?.focus();
});
}
What alternative solutions did you explore? (Optional)
changed the title [-]Not able to focus on main composer while edit composer is open[/-][+][$250] Not able to focus on main composer while edit composer is open[/+]on Jan 20, 2026
still investigating ios build crash after login with this error :
[javascript] [TypeError: Assertion failed: `SortCompare` must be an abstract closure taking 2 arguments]
Unhandled JS Exception: TypeError: Assertion failed: `SortCompare` must be an abstract closure taking 2 arguments
[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.
[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
Test:
Clear the Onyx cache
Go to any chat and send a message
Focus on the Composer
Press the Up Arrow to edit the message
Switch to another chat and then come back
Focus on the edit Composer
Focus on the main Composer
Verify the focus stays on the main Composer and does not jump to the edit Composer
Activity
melvin-bot commentedon Jan 16, 2026
Triggered auto assignment to @greg-schroeder (
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.annaweber830 commentedon Jan 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When the edit composer is open, the user can’t reliably focus the main composer. The main composer receives focus briefly, then focus snaps back to the edit composer—especially after switching chats and returning.
What is the root cause of that problem?
Our focus-management behavior includes automatic refocusing intended to keep editing stable (e.g., restoring the last focused composer / maintaining edit state across navigation). In this scenario, that auto-refocus logic can run after the user explicitly focuses the main composer, causing the edit composer to steal focus back.
Concretely, a delayed “restore focus” (triggered by blur/navigation/interaction completion) doesn’t distinguish between:
What changes do you think we should make in order to solve the problem?
Ensure the “last focused composer should regain focus” rule only applies when focus was lost due to non-user-intentional causes (e.g., transient UI events), not when the user explicitly taps/focuses the main composer.
App/src/libs/actions/InputFocus/index.website.ts
Lines 21 to 31 in e94f05d
What alternative solutions did you explore? (Optional)
yatin-italy commentedon Jan 16, 2026
Proposal
Restate the problem this issue is trying to solve.
What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
index.desktop.ts
Lines 20-32
index.website.ts
Lines 20-32
What alternative solutions did you explore? (Optional)
aimane-chnaif commentedon Jan 16, 2026
@greg-schroeder Please assign @blazejkustra and me here. This is coming from #79359 (comment)
melvin-bot commentedon Jan 20, 2026
@greg-schroeder Whoops! This issue is 2 days overdue. Let's get this updated quick!
[-]Not able to focus on main composer while edit composer is open[/-][+][$250] Not able to focus on main composer while edit composer is open[/+]melvin-bot commentedon Jan 20, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022013509624834775039
melvin-bot commentedon Jan 20, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @QichenZhu (
External)62 remaining items
QichenZhu commentedon Mar 7, 2026
How's it going? @M00rish
M00rish commentedon Mar 9, 2026
still investigating ios build crash after login with this error :
@QichenZhu
M00rish commentedon Mar 10, 2026
issue solved and PR opened for review
M00rish commentedon Mar 11, 2026
@QichenZhu friendly bump.
melvin-bot commentedon Mar 16, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
M00rish commentedon Mar 24, 2026
@greg-schroeder could you please process payment here ? Thanks.
Note: there's no regressions.
greg-schroeder commentedon Mar 24, 2026
Payment summary:
Author: @M00rish - $250 - Offer sent via Upwork
Reviewer: @QichenZhu - $250 - ND manual request
Approved for payments as outlined above ☝️
QichenZhu commentedon Mar 24, 2026
BugZero Checklist:
[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: Refactor
createTaskAndNavigate()to use useAncestors hook #73867 (comment)[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.
[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
Test:
Do we agree 👍 or 👎
twisterdotcom commentedon Mar 24, 2026
@QichenZhu has submitted payment for this report on ND here.
SO: https://stackoverflowteams.com/c/expensify/questions/7582
Zapier Logs
Run ID: 00040eee-5039-a9ed-11d3-d1f7b9d5aeb4M00rish commentedon Mar 25, 2026
Offer accepted @greg-schroeder.