Auto-scroll to next report preview that requires action#92467
Draft
MelvinBot wants to merge 1 commit into
Draft
Conversation
When the action-badge target advances after the user approves/pays an older report preview, scroll the report action list down to the next report preview that requires action. Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
When a report chat shows the "action badge" Floating Message Counter, the badge points at the oldest report preview that still requires action (approve/pay/etc.). Previously, after the user resolved that preview, nothing moved the list to the next preview that needs attention — the user had to manually scroll to find it.
This change makes the list automatically follow the badge target. The badge target is derived from
reportAttributes.actionTargetReportActionID, which advances to the next-actionable report preview once the current one is resolved. By watching that value, we scroll to the new target via the existingscrollToActionBadgeTargetmachinery (reportScrollManager.scrollToIndex).Key safeguards:
0= newest at the bottom, higher index = older at the top). The badge always targets the oldest actionable preview, so resolving it advances the target to a newer preview, i.e. a lower index. We only auto-scroll when the new target index is strictly lower than the previous target's index. This ensures we only scroll downward to the next actionable preview and never jump upward/backward (e.g. when older actions are loaded in via pagination).!isProduction, matching the rollout gating already applied to the action badge /onActionBadgePressbehavior in this file, so it does not change production behavior.The change is contained to
src/pages/inbox/report/ReportActionsList.tsxand reuses existing state and helpers (actionTargetReportActionID,actionBadgeTargetIndex,renderedVisibleReportActions,scrollToActionBadgeTarget) rather than threading new callbacks down through the approve/pay action buttons.Fixed Issues
$ #90278
PROPOSAL:
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.
Suggested manual verification (dev environment, where
isProductionisfalse):Offline tests
Same as Tests. The auto-scroll reacts to the locally-derived
reportAttributesstate, so it behaves the same offline once the optimistic approve/pay update is applied.QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari