Skip to content

feat: Shift+Click Range Selection Not Supported in Multi-Select Lists#92155

Draft
TaduJR wants to merge 11 commits into
Expensify:mainfrom
TaduJR:feat-New-Feature-Shift+Click-Range-Selection-Not-Supported-in-Multi-Select-Lists
Draft

feat: Shift+Click Range Selection Not Supported in Multi-Select Lists#92155
TaduJR wants to merge 11 commits into
Expensify:mainfrom
TaduJR:feat-New-Feature-Shift+Click-Range-Selection-Not-Supported-in-Multi-Select-Lists

Conversation

@TaduJR
Copy link
Copy Markdown
Contributor

@TaduJR TaduJR commented May 31, 2026

Explanation of Change

Implements Excel/AG Grid-style shift+click range selection across every multi-select list in the app. Click a row, hold Shift, click another — every row between them gets selected. Shift+click again to extend or shrink the range. Shift+Arrow does the same via keyboard.

Hook: src/hooks/useShiftRangeSelection.ts — an explicit, deterministic session protocol. Consumers call:

  • applyShiftClick(item, options) for shift+click
  • notifyAnchor(item) on plain click / focus change
  • clearAnchor() on Select All / Deselect All
  • extendByKeyboard(direction) for Shift+Arrow
  • getAnchorKey() to read the current anchor

The shift session lives between shift+clicks and is ended only by notifyAnchor or clearAnchor — no focus-based heuristic. Headers and disabled rows are excluded via isHeaderItem / isDisabledItem predicates; ranges span the visual order; the anchor always joins the range (matches Excel / Gmail / Outlook / Finder).

Consumer surfaces: 13 workspace pages wire it via BaseSelectionList's opt-in onShiftRangeApply prop (Tags, Categories, Members, Taxes, Rules, Distance Rates, Per Diem, Report Fields, Spend Rule Card / Category, Expense Rules, Room Members, Report Participants). Three lists with custom selection state — Search (all views including Spend grouped and Reports), MoneyRequestReportView's transaction list (including in-report grouped-by-category/tag layouts), and Workspace Expensify Card list — wire the hook directly.

Group-header semantics: In grouped views (Spend grouped + in-report grouped), shift+click on a group header extends the range through the whole group by routing to applyShiftClick with the loaded child farthest from the anchor. Collapsed groups fall back to the existing "select all in group" toggle.

Keyboard: New SHIFT_ARROW_UP/DOWN shortcuts in CONST/index.ts (with modifierFlags: keyModifierShift for native KeyCommand). BaseSelectionList registers them; extendByKeyboard walks the visual order skipping headers/disabled rows.

Helpers exported alongside the hook:

  • applyShiftRangeBatchToKeySet — primitive-key selection arrays (string[] / number[])
  • applyShiftRangeBatchToValueArray — object-keyed arrays storing hydrated values (WorkspacePerDiemPage)
  • getShiftKeyFromEvent — extracts shiftKey from any RN / RN-Web / DOM event shape

Fixed Issues

$ #90539
PROPOSAL: #90539 (comment)

Tests

Setup

  • A test workspace with at least 8 tags, 8 categories, and several taxes / distance rates / per diem rates / report fields.
  • A test expense report with at least 8 transactions across more than one category.
  • A workspace whose Spend → Expenses results have at least 12 transactions across multiple categories, tags, and merchants.

A. Workspace lists — basic shift+click range

Use Workspace → Tags as the representative page. Repeat on Categories, Members, Taxes, Distance Rates, Per Diem Rates, Report Fields, Expense Rules, Spend Rules → Card / Category, Room Members, Report Participants.

  1. Open the workspace → Tags.
  2. Click the checkbox of the 2nd tag.
  3. Hold Shift and click the checkbox of the 6th tag.
  4. Verify tags 2, 3, 4, 5, 6 are all checked.
  5. Without clicking anywhere else, Shift+click the checkbox of the 4th tag.
  6. Verify tags 5 and 6 become unchecked; 2, 3, 4 remain checked.
  7. Shift+click the checkbox of the 1st tag.
  8. Verify tags 1, 2 are checked; 3, 4 become unchecked.

B. Workspace lists — deselect-then-shift (anchor stays in range)

  1. On the Tags page, click the checkbox of the 3rd tag (it becomes checked).
  2. Click the same checkbox again (it becomes unchecked — list is empty).
  3. Shift+click the checkbox of the 7th tag.
  4. Verify tags 3, 4, 5, 6, 7 are all checked. Tag 3 must be included.

C. Workspace lists — Select All then shift+click

  1. On the Tags page, click the checkbox of the 1st tag.
  2. Shift+click the checkbox of the 5th tag (tags 1–5 checked).
  3. Click the Select All header checkbox.
  4. Shift+click the checkbox of the 3rd tag.
  5. Verify all tags remain checked. Tags 4, 5 (or any others) must not become unchecked.

D. Shift+Arrow keyboard nav (desktop with physical keyboard)

  1. Navigate to Workspaces → [your workspace] → Tags.
  2. Wait for the tag list to render. Do not click any tag yet (so nothing is selected).
  3. Click the checkbox of the 3rd tag once. Verify tag 3 is checked.
  4. Click the same checkbox again. Verify tag 3 is unchecked (list is empty again).
  5. Click the checkbox of the 3rd tag once more (so tag 3 is checked and is the anchor).
  6. Without clicking anywhere else, press and hold Shift, then press ArrowDown once. Release Shift.
  7. Tag 3 stays checked, and tag 4 (the next row down) also becomes checked.

E. Single-select radio picker — checkbox still selects

  1. Open any single-select radio list (e.g. Settings → Profile → Timezone).
  2. Click the radio circle of an option (not the row label).
  3. Verify the radio becomes checked and the page reacts as if you tapped the row.

F. Spend → Expenses (ungrouped)

  1. Top nav → SpendExpenses tab.
  2. Click the checkbox of the 1st transaction.
  3. Shift+click a transaction further down.
  4. Verify every transaction between them is checked.
  5. Shift+click a transaction above the original click.
  6. Verify the range flips: only rows from the new top through the original anchor stay checked.

G. Spend → Reports

  1. Top nav → SpendReports tab.
  2. Click the checkbox of the 1st report.
  3. Shift+click the checkbox of the 4th report.
  4. Verify reports 1–4 are checked (and their child transactions count as selected when expanded).
  5. Expand the 1st report (click the expand arrow).
  6. Click the checkbox of a child transaction inside.
  7. Expand another report and Shift+click one of its child transactions.
  8. Verify every child transaction between the two clicks is checked across reports.

H. Spend grouped — child range + group-header range

Use group by Category as the representative. Repeat for Tag, Merchant, Card, Member, Month, Week, Year, Quarter, Withdrawal ID.

  1. Top nav → Spend → group by Category (top toolbar).
  2. Expand a category. Click the checkbox of a child transaction inside.
  3. Expand a different category further down. Shift+click a child transaction inside it.
  4. Verify every child transaction between the two — across both categories and any expanded categories in between — is checked.
  5. Shift+click the header checkbox of a third (different) category.
  6. Verify the range extends through every child transaction of that third category.

I. Single expense report — in-report transaction list

  1. Open a single expense report from the Reports list.
  2. Click the checkbox of the 1st transaction in the report.
  3. Shift+click a transaction further down.
  4. Verify every transaction between them is checked.
  5. Switch the layout to Group by Category (or Tag).
  6. Click the checkbox of a child transaction in the first group.
  7. Shift+click the group header checkbox of a different group below.
  8. Verify every transaction between the original click and the end of the second group is checked. The click must register on the first press and no text should be highlighted on the page.

J. Workspace Expensify Cards list

  1. Open a workspace's Expensify Cards list.
  2. Click the checkbox of the 1st card.
  3. Shift+click a card further down.
  4. Verify every card between them is checked.
  5. Click Select All, then Deselect All.
  6. Shift+click the 3rd card.
  7. Verify only the 3rd card is checked.

K. Report Fields list values — enabled/disabled state preserved

  1. Open a workspace → Report Fields → pick a list-type field → values list.
  2. Toggle one value to disabled.
  3. Click the checkbox of the 1st value, then Shift+click a value further down.
  4. Verify the previously-disabled value is still disabled.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."
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
    • MacOS: Desktop
  • 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 there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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

@TaduJR TaduJR requested review from a team as code owners May 31, 2026 20:20
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 31, 2026

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

@melvin-bot melvin-bot Bot removed request for a team May 31, 2026 20:20
@TaduJR TaduJR changed the title Feat new feature shift+click range selection not supported in multi select lists feat: New Feature : Shift+Click Range Selection Not Supported in Multi-Select Lists May 31, 2026
@TaduJR TaduJR changed the title feat: New Feature : Shift+Click Range Selection Not Supported in Multi-Select Lists feat: Shift+Click Range Selection Not Supported in Multi-Select Lists May 31, 2026
@TaduJR TaduJR marked this pull request as draft May 31, 2026 20:31
@TaduJR
Copy link
Copy Markdown
Contributor Author

TaduJR commented May 31, 2026

@codex review

@codecov
Copy link
Copy Markdown

codecov Bot commented May 31, 2026

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

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

@TaduJR
Copy link
Copy Markdown
Contributor Author

TaduJR commented May 31, 2026

D. Shift+Arrow keyboard nav (desktop with physical keyboard)

  1. Navigate to Workspaces → [your workspace] → Tags.
  2. Wait for the tag list to render. Do not click any tag yet (so nothing is selected).
  3. Click the checkbox of the 3rd tag once. Verify tag 3 is checked.
  4. Click the same checkbox again. Verify tag 3 is unchecked (list is empty again).
  5. Click the checkbox of the 3rd tag once more (so tag 3 is checked and is the anchor).
  6. Without clicking anywhere else, press and hold Shift, then press ArrowDown once. Release Shift.

Expected
Tag 3 stays checked, and tag 4 (the next row down) also becomes checked.

@QichenZhu

We have upstream bug on react-native-key-command for the above case. Should we remove it for now and make a second PR, or handle it first on upstream?

@QichenZhu
Copy link
Copy Markdown
Contributor

QichenZhu commented Jun 1, 2026

@TaduJR I'm not sure this is relevant to the original issue, which only mentions Shift+Click. I strongly suggest writing the steps yourself to reflect the actual testing flow you did, as AI tends to generate excessive steps in seconds but testers need hours to execute them, which is not practical.

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