Repository navigation
Fix web composer focus after finishing message edits - #106081
Conversation
Co-authored-by: dmkt9 <dmkt9@users.noreply.github.com>
|
I created this draft PR from an upstream branch because I do not have push access to your fork. To copy it to your fork and push updates: git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-composerModalFocus
git checkout -b claude-composerModalFocus upstream/claude-composerModalFocus
git push -u origin claude-composerModalFocusYou can then close this PR and open one from your fork. |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@MelvinBot update your checklist:
|
|
🤖 Android test steps verification results: Verified on standalone Android NewDot: sending and both edit Cancel/Save succeeded. Main-composer autofocus was absent after header dismissal on native; desktop-only expectations remain unverified, and JS console inspection was blocked by tester permissions.
|
|
Updated Checked completed documentation and unit-test items. Left unverified testing/QA boxes unchecked rather than claiming tests were performed. |
|
@MelvinBot Check all the checkboxes. I've verified everything myself |
|
Checked all 36 checkboxes and noted that the verification was completed by you, |
|
@MelvinBot mark this PR as ready |
|
Marked this PR as ready for review. |
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
Reviewer Checklist
Screenshots/Videoschrome.mp4 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3df0878a9d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ReportActionComposeFocusManager.editComposerRef.current = composerRef.current; | ||
| } | ||
| return () => { | ||
| inputFocusChange(false); |
There was a problem hiding this comment.
Do not clear another editor's focus flag
On web, when multiple ReportScreen instances coexist, an old inline editor can unmount after another editor has installed its ref. The following ownership guard correctly detects that the unmounting instance is stale, but this unconditional write has already cleared the shared INPUT_FOCUSED flag. If the current editor is blurred behind a modal, it cannot immediately reassert the flag, so ComposerWithSuggestions.tsx lines 865-874 can focus the main composer when the modal closes instead of restoring the active edit. Clear the flag only as part of an owner-aware cleanup, capturing the mounted ref if necessary.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@MelvinBot verify this #106081 (comment). I'm unable to reproduce this scenario on my side.
There was a problem hiding this comment.
🤖 Web test steps verification results:
The claimed overlapping-editor race was not reproduced or disproved on dev NewDot web. UI navigation was blocked before entering inline editing; no internal state was simulated.
| Step | Status |
|---|---|
Enter inline editing of an own messageSent a test message and opened its conversation, but hover exposed no edit controls and secondary-click/long-press were unsupported. Editing was not reached; this is a tooling blocker, not an observed App failure. |
❌ |
Old editor unmounts after another editor becomes currentPrerequisite unverified. Further chat navigation was blocked by menu interaction limitations. Code review confirms the unconditional reset precedes the ownership guard (ReportActionItemMessageEdit.tsx:178–193), but ordinary report changes clear edit drafts (useClearReportActionDraftsOnReportChange.ts:9–46). Therefore, multiple mounted reports alone do not prove the alleged surviving-editor scenario. A concrete sequence that unmounts the stale editor while preserving a modal-blurred current editor is still needed.![]() ![]() |
❌ |
Modal-close focus returns to active edit versus main composerNot tested because no inline editor was active. The focus helper supports the conditional concern—a focused editor can reassert the flag, whereas a blurred editor cannot immediately do so (InputFocus/index.web.ts:12–34)—but the final focus outcome remains unverified. Treat the finding as a plausible ownership concern, not a confirmed regression; this run does not justify dismissing it either. |
❌ |
view run · no recording available
There was a problem hiding this comment.
When editing a message while another message is already being edited, the cleanup runs before the new edit composer is mounted. Additionally, composerFocusKeepFocusOn is called after the cleanup runs, so this scenario isn't reproducible.
|
Looks like we're waiting on a review from @roryabraham, right? |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.5.36-0 🚀
|
|
No FullStory changes needed — this PR only fixes web composer focus restoration after editing a message and adds a regression test, without introducing new user-facing functionality or content. |
|
No help site update needed — this PR restores expected message-field focus after editing and closing a modal, without adding a feature, changing a workflow, or making existing article instructions incorrect. |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.36-0 🚀
Bundle Size Analysis (Sentry): |




Explanation of Change
Reset the web edit-input focus flag when the message editor unmounts, before the existing focus-manager guard. This prevents a finished edit from blocking main-composer focus restoration after a subsequent modal closes. Implements the approved minimal proposal; the optional ref-cleanup change is intentionally excluded. Native behavior is unchanged because its input-focus action is a no-op.
AI Tests
INPUT_FOCUSEDremains true) and passes with it.npm run lint,npm run lint-changed,npm run typecheck,npm run spell-changed, and Storybook smoke test passed.origin/because the runner provides an empty base-ref value. Direct checks of this branch and the pristine main version report the same five pre-existing ref-during-render errors; no compiler regression found.prettierscript no longer exists in this checkout. Attempts to run the replacement formatter were denied by the runner.git diff --checkpassed.Fixed Issues
$ #105111
PROPOSAL: #105111 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
All checklist confirmations are recorded on behalf of
dmkt9, who confirmed personally verifying everything.### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
AI web evidence (normal header-dismissal focus only; edit-specific flows were blocked by tooling):
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari