Skip to content

Dismiss action badge pill when composer is expanded - #103752

Merged
arosiclair merged 9 commits into
Expensify:mainfrom
aimane-chnaif:fix-92650
Oct 14, 2026
Merged

arosiclair merged 9 commits into
Expensify:mainfrom
aimane-chnaif:fix-92650

Conversation

@aimane-chnaif

@aimane-chnaif aimane-chnaif commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

The action badge pill only hides once its target becomes viewable.
The expanded composer covers the list, so the target never becomes viewable and the pill stays after being clicked.
Now clicking it while the composer is expanded dismisses it, and scroll-based tracking of the Latest messages pill is paused while expanded so the scroll doesn't bring that pill back.

Fixed Issues

$ #92650

Tests

  1. Go to a workspace chat
  2. Create an expense, then create two or three empty reports
  3. Type multiline text in the composer until the expand button appears, then click it
  4. Click the "Submit" floating pill
  5. Verify the pill dismisses
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests

QA Steps

Same as 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
test.mov

@aimane-chnaif
aimane-chnaif marked this pull request as ready for review October 12, 2026 12:01
@aimane-chnaif
aimane-chnaif requested review from a team as code owners October 12, 2026 12:01
@melvin-bot
melvin-bot Bot requested review from JmillsExpensify and mkhutornyi and removed request for a team October 12, 2026 12:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

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 ✅ Completed 2026-10-14T00:22:24.675091Z b6560f8 Manual request
ℹ️ 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 commented Oct 12, 2026

Copy link
Copy Markdown

@mkhutornyi 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]

@mkhutornyi

Copy link
Copy Markdown
Contributor

Bunch of tests failing

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c457be617

ℹ️ 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".

Comment thread src/hooks/useReportActionsScroll.ts Resolved
@aimane-chnaif

Copy link
Copy Markdown
Contributor Author

Bunch of tests failing

Fixed.

job 3, job 7 still failing but unrelated. Happening on main at the moment

@mkhutornyi

mkhutornyi commented Oct 13, 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.mov
Android: mWeb Chrome
iOS: HybridApp
ios.mp4
iOS: mWeb Safari
msafari.mp4
MacOS: Chrome / Safari
web.mov

@mkhutornyi

Copy link
Copy Markdown
Contributor

Bug: "Latest messages" pill is missing after collapsing the composer until scroll again

bug.mp4

@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

Verdict: The approach works for the reported bug, but it causes the regression you found. Please fix that before merging.

🐛 "Latest messages" pill stays hidden after you collapse the composer

Cause: While the composer is expanded, scroll events still update scrollOffsetRef, but they skip updatePillVisibility() (useReportUnreadMessageScrollTracking.ts:117-127). Clicking the action badge pill hides both pills and scrolls up (useReportActionsScroll.ts:411-417). When the composer collapses, nothing checks the offset again, so the pill stays hidden until the next scroll event.

The unread-marker pill and the action badge pill recover by themselves. The full-size footer (chatFooterFullCompose, height: '100%') shrinks the list to nothing, so it has no viewable items. When the list gets its height back, onViewableItemsChanged runs again. Only the offset-based "Latest messages" pill has no trigger.

Suggested fix: Recheck the pill when the composer collapses. useReportActionsScroll already imports usePrevious and useEffectEvent.

const prevIsComposerFullSize = usePrevious(isComposerFullSize);
// Scroll events skipped pill tracking while expanded, so sync the Latest messages pill with the current offset
const syncPillAfterComposerCollapse = useEffectEvent(() => {
    if (!prevIsComposerFullSize || isComposerFullSize || shouldDisablePillTracking) {
        return;
    }
    updatePillVisibility();
});
useEffect(() => {
    syncPillAfterComposerCollapse();
}, [isComposerFullSize]);

Please add a unit test for the collapse case: expanded → collapsed with scrollOffsetRef above ACTION_VISIBLE_THRESHOLD, then expect updatePillVisibility to run. The current mock doesn't return updatePillVisibility, so you will need to add it.

Other notes (no action needed)
  • The Codex comment about the missing // When is fixed. The test now has // When the hook renders.
  • I agree with your reply to the Codex comment about onLoad. Initial linked positioning doesn't change scrollOffsetRef, so the direct updatePillVisibility() call in onLoad shouldn't show the pill over the expanded composer.
  • The rest of the change is small and well scoped. Returning setIsActionBadgeAboveViewport from the tracking hook is fine, and the existing tests cover both the expanded and normal composer paths.

I reviewed the code only. I didn't run the app, because your video already reproduces the bug.


view run

@aimane-chnaif

Copy link
Copy Markdown
Contributor Author

Bug: "Latest messages" pill is missing after collapsing the composer until scroll again

bug.mp4

Fixed

@mkhutornyi

mkhutornyi commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Bug (iOS): after following Tests steps and collapsing composer, Submit pill should be clicked twice to scroll up to the submit preview

ios.mp4

The same bug also happens on main/staging so I think we can consider this out of scope

Repro step:

  1. Go to a workspace chat
  2. Create an expense, then create two or three empty reports
  3. Scroll to the top of the chat so that "Latest messages" pill shows
  4. Type multiline text in the composer until the expand button appears, then click it
  5. Click the "Latest messages" pill
  6. Verify the pill dismisses
  7. Collapse composer
  8. Click "Submit" pill

Expected: Chat is scrolled to the top so that report preview shows
Actual: Chat flickers and then stuck at the bottom. Clicking pill once again scrolls to the top where report preview is.

ios-main.mp4

@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

Verdict: The new commit fixes the "Latest messages" pill regression. One small request: add a unit test for it. I found no other issues.

  • ✅ Restore Latest messages pill after collapsing composer syncs the pill when the composer goes from expanded to collapsed (useReportActionsScroll.ts:244-254). Scroll events update scrollOffsetRef even while tracking is paused, so the check uses the correct offset. The shouldDisablePillTracking guard keeps it from interfering with the initial positioning of a linked message.
  • ⚠️ Missing test: The commit only changes useReportActionsScroll.ts. Please add a case to useReportActionsScrollTest.tsx: render with the composer expanded, set it to collapsed, and expect updatePillVisibility to run. The mock doesn't return updatePillVisibility yet, so you will need to add it.
  • iOS "click Submit twice" bug: I agree it's out of scope. Your repro shows it on main and staging too, and this PR doesn't change the scroll call. A separate issue makes sense.
  • Failing checks: Neither failure comes from this PR. typecheck fails in tests/actions/PolicyTest.ts, and ESLint check fails on deprecated MenuItemWithTopDescription usages. This PR touches neither. A merge from main should clear them once main is fixed.

view run

@MelvinBot

Copy link
Copy Markdown
Contributor

⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai.

Run details

@MelvinBot

Copy link
Copy Markdown
Contributor

Regression check

Verdict: I found one low-severity regression. It's an edge case, so fixing it is optional. Nothing else in the current diff changes behavior outside the expanded-composer flow.

⚠️ The pill stops tracking when the expanded flag outlives the composer

The new code reads only the Onyx flag reportIsComposerFullSize_<reportID> (useReportActionsScroll.ts:174, :236, :424). That flag is persisted. Only three things reset it: the collapse button, sending a message, and clearing the text.

ReportFooter can hide the composer while the flag is still true (ReportFooter.tsx:97). Examples: a support ticket while offline, an archived room, or a user blocked from chat. In those footers, the full-size style isn't applied (ReportFooter.tsx:140), so the list is fully visible. But the hook still treats it as covered:

  • Scrolling up never shows the "Latest messages" pill.
  • Clicking the action badge pill hides both pills right away.

Repro (untested): Open a support ticket chat. Type multiline text and expand the composer. Go offline. Scroll up. The "Latest messages" pill doesn't appear. On main, it does.

Possible fix: Have ReportFooter reset the flag when it hides the composer: shouldHideComposer && isComposerFullSize → setIsComposerFullSize(reportID, false). You could also skip this as out of scope, since all three states are rare.

Checked with no regression found
  • Switching reports: ReportActions is keyed by reportID (ReportActions.tsx:98). A new report remounts the hook, so prevIsComposerFullSize and scrollOffsetRef from report A can't trigger the collapse sync on report B.
  • Opening a report with the flag already true: usePrevious starts out falsy, so the collapse sync doesn't run on mount.
  • Linked-message mount: The shouldDisablePillTracking guard in the collapse sync (:247) keeps it out of the way during initial positioning.
  • Sending while expanded: Sending collapses the composer and scrolls to the new message, which hides the pill again. If you clicked the action badge pill while expanded and then send while scrolled up, the pill may flash for a frame. I don't think that's worth fixing.
  • Unread marker and action badge pills after collapsing: updatePillVisibility skips these. They rely on onViewableItemsChanged running again when the list gets its height back. Your video shows this works on web. I haven't confirmed it on native.
  • Only consumer: ReportActionsList is the only caller of useReportActionsScroll. MoneyRequestReportActionsList isn't affected.
  • iOS "click Submit twice": It also happens on main, as mkhutornyi noted, so this PR didn't cause it.

This review is based on the code only. I didn't run the app.


view run

@mkhutornyi

mkhutornyi commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Regression check

Verdict: I found one low-severity regression. It's an edge case, so fixing it is optional. Nothing else in the current diff changes behavior outside the expanded-composer flow.

⚠️ The pill stops tracking when the expanded flag outlives the composer

The new code reads only the Onyx flag reportIsComposerFullSize_<reportID> (useReportActionsScroll.ts:174, :236, :424). That flag is persisted. Only three things reset it: the collapse button, sending a message, and clearing the text.

ReportFooter can hide the composer while the flag is still true (ReportFooter.tsx:97). Examples: a support ticket while offline, an archived room, or a user blocked from chat. In those footers, the full-size style isn't applied (ReportFooter.tsx:140), so the list is fully visible. But the hook still treats it as covered:

  • Scrolling up never shows the "Latest messages" pill.
  • Clicking the action badge pill hides both pills right away.

Repro (untested): Open a support ticket chat. Type multiline text and expand the composer. Go offline. Scroll up. The "Latest messages" pill doesn't appear. On main, it does.

Possible fix: Have ReportFooter reset the flag when it hides the composer: shouldHideComposer && isComposerFullSize → setIsComposerFullSize(reportID, false). You could also skip this as out of scope, since all three states are rare.

Agree edge case and not blocker

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6560f8092

ℹ️ 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".

unreadMarkerReportActionIndex,
isInverted: true,
// The list is hidden behind the expanded composer, so scrolling it must not bring the Latest messages pill back
shouldDisablePillTracking: shouldDisablePillTracking || isComposerFullSize,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate pill tracking on the rendered composer

When an expanded report stops rendering its composer without one of the composer handlers running—for example, an unresolved support ticket goes offline or a room is remotely archived/blocked—the REPORT_IS_COMPOSER_FULL_SIZE Onyx value remains true because all of its clear calls live in the now-unmounted composer. This expression consequently keeps scroll-based pill tracking disabled even though ReportFooter has exposed the action list, so scrolling history cannot show or hide the Latest messages pill until the composer becomes available and is manually collapsed; gate this on the composer actually being rendered, or clear the flag when the footer hides it.

AGENTS.md reference: AGENTS.md:L3-L3

Useful? React with 👍 / 👎.

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.

@melvin-bot

melvin-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to #92650 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot
melvin-bot Bot requested a review from arosiclair October 14, 2026 00:45
@arosiclair
arosiclair merged commit 75deead into Expensify:main Oct 14, 2026
37 of 41 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/arosiclair in version: 9.5.10-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed. This is a bug fix: clicking a floating action pill (for example, Submit) while the composer is expanded now dismisses the pill as users would expect, and no article under docs/articles describes this behavior.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/arosiclair in version: 9.5.12-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed. The code hasn't changed since my earlier review: this bug fix makes a floating action pill (for example, Submit) dismiss when clicked while the composer is expanded, which is what users already expect, and no article under docs/articles describes this behavior.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/cristipaval in version: 9.5.12-1 🚀

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

Bundle Size Analysis (Sentry):

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