Skip to content

Point the auto-scroll action pill down when its target is below the scroll position - #98576

Draft
MelvinBot wants to merge 2 commits into
mainfrom
claude-actionBadgePillPointDown
Draft

Point the auto-scroll action pill down when its target is below the scroll position#98576
MelvinBot wants to merge 2 commits into
mainfrom
claude-actionBadgePillPointDown

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

Extends the chat's floating action-badge pill (added in #86064, which only handled the case where the target is above the scroll position with a ^ arrow) to also handle the complementary case: when the report action causing the LHN action badge (Approve/Pay/Fix/etc.) is below the current scroll position, the pill now shows with a down () arrow and, when clicked, scrolls the user down to that row.

What changed:

  • useReportUnreadMessageScrollTracking now also tracks isActionBadgeBelowViewport alongside the existing isActionBadgeAboveViewport. In the inverted list, the target is "below" (newer) when its index is less than the min visible index, and "above" (older) when greater than the max visible index.
  • useReportActionsScroll threads the new isActionBadgeBelowViewport value through.
  • ReportActionsList now shows the action pill whenever the target is out of view (above or below), and passes the direction down to the pill.
  • FloatingMessageCounter renders the DownArrow icon instead of UpArrow when the target is below the viewport.

The existing click behavior already uses scrollToIndex(...), which scrolls in either direction, so no scroll-logic change was needed. The behavior remains gated to non-production, matching the existing action-pill rollout.

Fixed Issues

$ #94796
PROPOSAL:

Tests

// TODO: The human co-author must fill out / confirm the manual test steps before marking this PR as "ready for review".

Suggested steps:

  1. On a non-production build, open an expense/chat report that has multiple report previews requiring action (e.g. Approve/Pay/Fix), with at least one action-badge target below your current scroll position (scroll up so a newer actionable preview is off the bottom of the viewport).
  2. Verify the colored action pill appears at the top of the chat showing the correct action label with a down () arrow.
  3. Click the pill and verify it scrolls you down to the row causing the action badge.
  4. Scroll so the actionable preview is instead above the viewport and verify the pill shows the up (^) arrow and scrolls up when clicked.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • 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 followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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 followed the guidelines as stated in the Review Guidelines
  • 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 a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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.
  • 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

…sition

Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

All three failing checks are infrastructure flakes, not code problems — no fix to push.

Each of ESLint check, build (Debug, true), and test (job 1) failed with the identical runner-level error, not a lint/build/test assertion:

The self-hosted runner lost communication with the server. Verify the machine is running and has a healthy network connection. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.

The runner died mid-job, so these jobs never produced a real result. This is unrelated to the diff (which only touches the action-badge pill direction logic and its tests).

I confirmed locally that ESLint passes on all six changed files (useReportActionsScroll.ts, FloatingMessageCounter.tsx, ReportActionsList.tsx, useReportUnreadMessageScrollTracking.ts, and the two test files) — 0 errors, only pre-existing seatbelt warnings.

The remaining failing checks — Check independent approval and checklist — are the standard checklist/approval gates and resolve through the normal review process.

Recommended action: re-run the failed jobs (Actions → the failed run → "Re-run failed jobs"). I don't have permission to trigger the re-run from here. They should pass once they land on a healthy runner.

@aimane-chnaif

Copy link
Copy Markdown
Contributor

@MelvinBot pull main

…lPointDown

Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Pulled main into claude-actionBadgePillPointDown and pushed. The merge was clean — no conflicts.

The branch was 1 commit behind; it's now up to date with main at 3f20d89.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Update: the code checks now pass — nothing to fix.

The three checks that were failing earlier (ESLint check, build (Debug, true), test (job 1)) were self-hosted-runner infrastructure flakes ("the self-hosted runner lost communication with the server"), not code problems. They have since re-run and are green.

The only remaining red checks are PR Author Checklist and Check independent approval — standard author/review gates that resolve through the normal PR checklist and peer-review process, not code changes.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Update: the checks have been re-run and the infra flakes cleared — no code fix was needed.

On the latest run, the three previously-failing checks now pass:

  • ESLint check
  • test (job 1)
  • build (Debug, true) — re-running (pending), was the same runner flake

The three earlier failures were all the same self-hosted-runner infrastructure error ("The self-hosted runner lost communication with the server"), not anything in the diff. They passed once they landed on healthy runners.

The only checks still red are Check independent approval and checklist — the standard review/approval gates, which resolve through the normal review process, not a code change.

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.

2 participants