Skip to content

[LegendList 4/15] fix: stabilize composer focus and scroll notifications - #104977

Merged
roryabraham merged 3 commits into
Expensify:mainfrom
margelo:@chrispader/fix/legend-list-composer-preparation
Oct 28, 2026
Merged

roryabraham merged 3 commits into
Expensify:mainfrom
margelo:@chrispader/fix/legend-list-composer-preparation

Conversation

@chrispader

@chrispader chrispader commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Closing an inline editor can replace the input before delayed focus runs, and the notification banner can appear after the list measures. This PR resolves the current input when focus executes and initializes notification permission before the first layout. It also keeps list scroll notifications scoped to inverted lists and identifies local and realtime action events.

@roryabraham @dmkt9

Explanation of Change

This is layer 4 of the fifteen-part LegendList series. It extracts the composer and notification preparation from #100733, which remains the list migration in layer 12. Report actions continue to use the existing inverted FlashList.

Review and merge order: fifteen-part LegendList rollout. Layers 6 to 8 are independent preparations; merge all three before layer 12.

Fixed Issues

$ #98994

Part of the migration split from #98270. No approved proposal is linked.

Tests

All platforms means desktop web, mobile web, Android, and iOS.

All platforms, save and cancel a message edit

  1. Open a chat.
  2. Send a short message.
  3. Open that message's action menu.
  4. Choose Edit.
  5. Change the message text.
  6. Save the edit. The updated message should appear.
  7. Type in the message box at the bottom. The text should appear in that box.
  8. Open the edited message's action menu.
  9. Choose Edit.
  10. Change the message text again.
  11. Cancel the edit. The previously saved text should remain.
  12. Type more text in the message box at the bottom. The text should appear in that box.

Android and iOS apps, keyboard after returning to a chat

  1. Open a chat containing an expense preview.
  2. Open the expense preview.
  3. Return to the chat.
  4. Tap the message box. The keyboard should open.
  5. Type a message. The text should appear in the visible message box.

Desktop Chrome, notification permissions

  1. Set the app site's notification permission to Ask in Chrome's site settings.
  2. Reload the app.
  3. Open Concierge. The enable-notifications banner should be present when the chat appears, without a late jump in the messages.
  4. Choose Not now. The banner should disappear.
  5. Set the app site's notification permission to Allow in Chrome's site settings.
  6. Reload the app.
  7. Open Concierge. The enable-notifications banner should be absent.
  8. Set the app site's notification permission to Block in Chrome's site settings.
  9. Reload the app.
  10. Open Concierge. The enable-notifications banner should be absent.

Desktop web, message hover actions while scrolling

  1. Open a chat with scrollable history.
  2. Hover over a message. Its action toolbar should appear.
  3. Scroll the chat. The hover toolbar should disappear.
  • Verify that no errors appear in the JS console

Offline tests

All platforms, cancel an edit offline

  1. Open a chat containing one of your own messages while online.
  2. Disconnect the internet.
  3. Open your message's action menu.
  4. Choose Edit.
  5. Change the message text.
  6. Cancel the edit. The original message should remain.
  7. Type in the message box at the bottom. The text should appear in that box.
  8. Reconnect the internet.

QA Steps

Run the All platforms cases and the blocks for the platform being tested, including Offline tests.

  • 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
  • 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 any copy / text that was added to the app 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • 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)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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

All platforms, save a message edit

Screen_Recording_20261027_181444_Expensify.Dev.mp4
iOS: Native

All platforms, save and cancel a message edit

pr4-ios-save-cancel-upload.mp4

All platforms, save a message edit

Screen.Recording.iPhone.18.Pro.27-10-2026.at.17.37.15.mp4

Cold chat open and initial loading

FlashList is on the left and LegendList is on the right. FlashList leaves the report body blank during loading; LegendList shows the report-action skeleton before messages appear.

LegendListLoadingSkeletonVsFlashList.mp4

Cold expense-chat open

FlashList is on the left and LegendList is on the right. Both progress from the loading skeleton to an expense preview and its surrounding report actions.

ExpenseChatCold.mp4

Warm expense-chat open

FlashList is on the left and LegendList is on the right. Both open the cached expense preview and report actions from the inbox.

ExpenseChatWarm.mp4

Warm chat open

Side-by-side opens of the same cached chat, ending on the same report-action history. The implementations are not labeled in this recording.

LegendListWarmReportOpen.mp4
MacOS: Chrome / Safari

All platforms, save a message edit

Screen.Recording.2026-10-27.at.17.13.08.mov

Resolve the current composer after delayed focus, reserve notification-banner space on initial layout, and keep inverted-list scroll events scoped to their existing callers. Expose local and realtime notification sources with a backward-compatible callback signature.

Co-authored-by: Codex <noreply@openai.com>
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/components/FlashList/index.tsx 100.00% <100.00%> (ø)
src/components/FlatList/FlatList/index.ios.tsx 73.68% <100.00%> (ø)
src/components/FlatList/FlatList/index.tsx 56.20% <100.00%> (+56.20%) ⬆️
...c/components/KeyboardDismissibleFlatList/index.tsx 100.00% <100.00%> (+100.00%) ⬆️
src/hooks/useEmitComposerScrollEvents/index.ts 90.32% <100.00%> (+90.32%) ⬆️
...otification/notificationPermission/index.native.ts 50.00% <100.00%> (+16.66%) ⬆️
src/libs/actions/Report/index.ts 74.88% <100.00%> (ø)
src/libs/actions/Report/reportActionSubscribers.ts 100.00% <100.00%> (ø)
src/libs/focusComposerWithDelay/index.ts 100.00% <100.00%> (+3.84%) ⬆️
...rt/ReportActionCompose/ComposerWithSuggestions.tsx 67.09% <100.00%> (ø)
... and 2 more
... and 24 files with indirect coverage changes

Co-authored-by: Codex <noreply@openai.com>
@chrispader

Copy link
Copy Markdown
Contributor Author

@MelvinBot request review from @roryabraham and @dmkt9 and assign them here.

@MelvinBot

Copy link
Copy Markdown
Contributor

Done. I requested reviews from roryabraham and dmkt9 and added both as assignees on this PR.


view run

@dmkt9

dmkt9 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Hi @roryabraham, I found a bug where the composer doesn't regain focus when a modal is closed after editing a message.
Since this bug isn't related to our PR and is also reproducible on staging, should we create a separate issue for it?

2026-10-27.11-18-49.mp4

@dmkt9

dmkt9 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

@chrispader The changes look good to me. Can you resolve the conflicts and mark this PR as ready?

@roryabraham

Copy link
Copy Markdown
Contributor

Since this bug isn't related to our PR and is also reproducible on staging, should we create a separate issue for it?

Yes, sounds good. Please go ahead and open the issue using the standard Steps to reproduce/Expected Results/Actual Results template 👍🏼

@dmkt9

dmkt9 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Open a separate issue for this bug: #104977 (comment), based on the CME's agreement here: #104977 (comment), and assign it to @roryabraham and me.

Steps to Reproduce

  1. Open the app in a desktop browser.
  2. Go to any chat.
  3. Send a message.
  4. Click the chat header to open a modal, then close it. Verify that the composer automatically regains focus.
  5. Right-click the message > Edit comment > Cancel or Save.
  6. Click the chat header again to open the modal, then close it.
  7. Notice that the composer doesn't regain focus.

Expected Result

The composer should automatically regain focus after the modal is closed.

Actual Result

The composer doesn't regain focus after the modal is closed.

@MelvinBot

Copy link
Copy Markdown
Contributor

I created Web - Chat - Composer doesn't regain focus after closing a modal once a message has been edited and assigned it to @roryabraham and @dmkt9.

It uses your steps, expected result, and actual result. It also includes your video and links back to the two PR comments. I added the Bug label. I found no existing issue that matches this bug.


view run

@chrispader

Copy link
Copy Markdown
Contributor Author

Finishing up this PR right now @dmkt9 @roryabraham !

Preserve inverted-list scroll notifications alongside main's compiler cleanup.

Co-authored-by: Codex <noreply@openai.com>
@chrispader
chrispader marked this pull request as ready for review October 27, 2026 17:38
@chrispader
chrispader requested review from a team as code owners October 27, 2026 17:38
@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team October 27, 2026 17:38
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-27T17:38:29.571886Z 945622d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@melvin-bot
melvin-bot Bot requested review from marcaaron and removed request for a team October 27, 2026 17:39
@melvin-bot

melvin-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

@marcaaron Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@marcaaron
marcaaron removed their request for review October 27, 2026 19:30
@dmkt9

dmkt9 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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 the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android.hybrid.mp4
Android: mWeb Chrome
iOS: HybridApp
ios.hybrid.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
chrome.mp4

@dmkt9 dmkt9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@roryabraham
roryabraham merged commit 80700be into Expensify:main Oct 28, 2026
42 of 45 checks passed
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/roryabraham in version: 9.5.25-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update is needed. This PR fixes timing problems with composer focus, list scroll events, and when the notifications banner first appears, so no feature changes and no article sentence becomes wrong.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.25-2 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@chrispader chrispader changed the title [LegendList 4/9] fix: stabilize composer focus and scroll notifications [LegendList 4/12] fix: stabilize composer focus and scroll notifications Oct 30, 2026
@chrispader chrispader changed the title [LegendList 4/12] fix: stabilize composer focus and scroll notifications [LegendList 4/13] fix: stabilize composer focus and scroll notifications Nov 9, 2026
@chrispader chrispader changed the title [LegendList 4/13] fix: stabilize composer focus and scroll notifications [LegendList 4/14] fix: stabilize composer focus and scroll notifications Nov 10, 2026
@chrispader chrispader changed the title [LegendList 4/14] fix: stabilize composer focus and scroll notifications [LegendList 4/15] fix: stabilize composer focus and scroll notifications Nov 11, 2026
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.

5 participants