Skip to content

Make report, expense, and member values copyable - #97277

Merged
JS00001 merged 188 commits into
Expensify:mainfrom
x-dev90:fix/96948-copyable-row-values
Oct 14, 2026
Merged

JS00001 merged 188 commits into
Expensify:mainfrom
x-dev90:fix/96948-copyable-row-values

Conversation

@x-dev90

@x-dev90 x-dev90 commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

This PR improves copy/paste behavior for values rendered inside interactive rows.

Many amount, report, expense, and member values are displayed inside pressable components. Those components can disable native text selection or intercept the mouse-down and press events required to begin selection, making it difficult to copy individual values without triggering the row action.

The PR introduces an opt-in copyable-text flow that:

  • Marks eligible values with shared copyable-row and copyable-text attributes.
  • Applies selectable-text styling where copying is supported.
  • Coordinates mouse, touch, press, focus, and long-press behavior so selecting text does not unintentionally open, focus, select, or activate the row.
  • Preserves normal row interactions when the user starts the gesture outside a copyable value.
  • Keeps native behavior safe through platform-specific no-op/native implementations.

The flow is applied across the affected areas, including:

  • Expense amounts and totals
  • Expense-detail values
  • Report titles, IDs, grouped/list values, and totals
  • Expense and transaction list columns
  • Workspace member names, emails, and custom fields
  • HTML-rendered titles and other selectable text
  • User pills and display-name content
  • Receipt, category, merchant, tag, tax, type, and related transaction values where applicable

SelectionScraper was updated to preserve explicitly marked copyable values while continuing to exclude content that should not be copied, such as controls, indicators, and unrelated row metadata.

The PR also adds or updates tests for:

  • Copyable values across multiple rows
  • Partial selections and row boundaries
  • Hidden versus explicitly copyable elements
  • HTML and transformed-node serialization
  • Press, touch, focus, and long-press interaction handling
  • Selectable HTML titles and related component behavior

Platform behavior is documented separately: desktop web supports mouse-drag selection, while mobile web uses the browser’s native press-and-hold selection flow. The tests that use window.getSelection() and Range validate the web implementation; mobile verification should confirm press-and-hold selection manually or through focused mobile interaction tests.

This description reflects the current branch scope, which includes shared selection infrastructure, pressable components, expense/report/member flows, transaction rows, and their related tests.

Fixed Issues

$ #96948
PROPOSAL: #96948 (comment)

Tests

Flow 1: Expense details

Desktop web

  1. Open an expense detail page.
  2. Drag-select the visible amount.
  3. Copy the selected amount and paste it into a plain-text field.
  4. Verify that only the selected amount is pasted.

Mobile web

  1. Press and hold the visible amount.
  2. Adjust the native selection handles to select the intended value.
  3. Copy and paste the selection into a plain-text field.
  4. Verify that only the selected amount is pasted.

Flow 2: Spend Reports and Expenses

Desktop web

  1. Navigate to Spend > Reports.
  2. Drag-select report values, including report titles, report IDs, totals, and workspace names.
  3. Copy and paste the selected values into a plain-text field.
  4. Verify that only the selected report values are pasted.
  5. Navigate to Spend > Expenses.
  6. Drag-select expense values, including dates, merchants, descriptions, categories, tags, and amounts.
  7. Copy and paste the selected values into a plain-text field.
  8. Verify that only the selected expense values are pasted.

Mobile web

  1. Repeat the Reports and Expenses checks using press-and-hold selection.
  2. Adjust the native selection handles, copy the selection, and paste it into a plain-text field.
  3. Verify that only the intended values are pasted.

Flow 3: Workspace Members

Desktop web

  1. Navigate to Workspace > Members.
  2. Drag-select a member name, email, or custom-field value.
  3. Copy and paste the selected value into a plain-text field.
  4. Verify that the pasted text matches the selected member value.

Mobile web

  1. Press and hold a member name, email, or custom-field value.
  2. Adjust the native selection handles to select the intended value.
  3. Copy and paste the selection into a plain-text field.
  4. Verify that only the selected member value is pasted.
  • Verify that no errors appear in the JS console.

Offline tests

Same as Test

QA Steps

Same as Tests

// 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.
    • 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

N/A

Android: mWeb Chrome
Screenrecorder-2026-09-02-23-26-16-923.mp4
Screenrecorder-2026-09-02-21-30-58-235.mp4
iOS: Native

N/A

iOS: mWeb Safari
Screen.Recording.2026-09-03.at.3.26.53.AM.mov
Screen.Recording.2026-09-03.at.3.21.08.AM.mp4
MacOS: Chrome / Safari
Screen.Recording.2026-07-29.at.11.15.05.AM.mov

@codecov

codecov Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Coverage Δ
src/CONST/index.ts 95.90% <ø> (ø)
src/components/AvatarWithDisplayName.tsx 80.61% <100.00%> (+0.19%) ⬆️
src/components/DisplayNames/index.native.tsx 100.00% <100.00%> (ø)
src/components/FormHelpMessage.tsx 100.00% <100.00%> (ø)
src/components/MenuItem/MenuItemContext.tsx 87.50% <ø> (+25.00%) ⬆️
...em/leaves/content/base/BaseMenuItemPrimaryText.tsx 100.00% <100.00%> (ø)
...leaves/content/base/BaseMenuItemSupportingText.tsx 100.00% <100.00%> (ø)
.../MenuItem/leaves/helpText/BaseMenuItemHelpText.tsx 100.00% <100.00%> (ø)
...ents/MenuItem/leaves/helpText/MenuItemHelpText.tsx 100.00% <100.00%> (ø)
src/components/MenuItem/presets/MenuItemField.tsx 100.00% <100.00%> (ø)
... and 73 more
... and 12 files with indirect coverage changes

@melvin-bot
melvin-bot Bot requested review from FitseTLT and removed request for a team July 29, 2026 07:59
@melvin-bot

melvin-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

@FitseTLT 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 requested review from JmillsExpensify and removed request for a team July 29, 2026 07:59
Comment thread src/libs/SelectionScraper/index.ts Resolved

@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: 2b6ff4f686

ℹ️ 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/components/MenuItem.tsx Resolved
@FitseTLT

Copy link
Copy Markdown
Contributor

@x-dev90 Pls always respond to all codex reviews if you don't agree with the review you should still state it putting 👎 reaction to the comment.

@JmillsExpensify JmillsExpensify 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.

All LGTM

@FitseTLT

Copy link
Copy Markdown
Contributor

@codex REVIEW

@x-dev90

x-dev90 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Hi @FitseTLT, I’ve addressed the automated review feedback and pushed the updates. Could you please take another look when you have a chance?

Thank you!

@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: 90714cc808

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

@x-dev90

x-dev90 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@FitseTLT, Gentle bump. thanks.

@x-dev90

x-dev90 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@FitseTLT ,Quick bump. Thanks!

@FitseTLT

FitseTLT commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

When cells are truncated selection doesn't select all text but if you select beyond the current cell it will select whole text

2026-08-03.18-40-57.mp4

@FitseTLT

Copy link
Copy Markdown
Contributor

Hi @FitseTLT, during manual testing on mobile web, I noticed that the Receipt label can be highlighted in a multi-field selection but is excluded from the copied output because it is not marked for SelectionScraper. Should we include this label in the copied output, or make it non-selectable to remain consistent with the other supporting field labels?

I don't see a use of making it selectable

@FitseTLT,On the main branch, this is selectable and copyable. Do you have any concerns with that behavior?

Hmm I know it is selectable on main but I don't see a use of being selectable. WDYT @JS00001 we are talking about this

image

@JS00001

JS00001 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

I think it is fine that that isnt selectable

@JS00001

JS00001 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

@FitseTLT I'm finishing up my review, do you want to re-review w/ the latest changes?

JS00001
JS00001 previously approved these changes Oct 14, 2026
@x-dev90

x-dev90 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@JS00001, Please hold off on merging this, i will do another round of testing and let you know. thanks.

@x-dev90

x-dev90 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Hi @FitseTLT and @JS00001, upstream commit 253253c reverted the report inline-input implementation, so these fields are menu items again. It also removed the selection behavior added by this PR.
We previously agreed not to change the fields while they were native inputs, since each was already individually selectable and copyable, and multi-input selection was outside this PR’s scope. Now that they’re menu items again, I’ll restore only the scoped behavior needed to make their values selectable and copyable.

Screencast.From.2026-10-14.16-19-31.mp4

@FitseTLT

Copy link
Copy Markdown
Contributor

Hi @FitseTLT and @JS00001, upstream commit 253253c reverted the report inline-input implementation, so these fields are menu items again. It also removed the selection behavior added by this PR. We previously agreed not to change the fields while they were native inputs, since each was already individually selectable and copyable, and multi-input selection was outside this PR’s scope. Now that they’re menu items again, I’ll restore only the scoped behavior needed to make their values selectable and copyable.

Screencast.From.2026-10-14.16-19-31.mp4

Why is it reverted? if it is temporary then the changes are not necessary they will reapply it. We can ignore it cc @JS00001

@x-dev90

x-dev90 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @FitseTLT, during manual testing on mobile web, I noticed that the Receipt label can be highlighted in a multi-field selection but is excluded from the copied output because it is not marked for SelectionScraper. Should we include this label in the copied output, or make it non-selectable to remain consistent with the other supporting field labels?

I don't see a use of making it selectable

I think it is fine that that isnt selectable

@FitseTLT, Since you agreed that this label shouldn’t be selectable or copied, I’ll fix the bug I reported in this comment by making the Receipt label non-selectable and non-copyable. I’m working on this now.

@JS00001

JS00001 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

lmk when this is re-ready please

@x-dev90

x-dev90 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

lmk when this is re-ready please

@JS00001 , Thanks! I’ve retested all affected flows, and everything is working as expected on my side. As agreed in this feedback, I did not make any additional changes to the report fields because the upstream revert is temporary and the original implementation is expected to be restored.

@JS00001

JS00001 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

lets :shipit:

@x-dev90 please keep an eye out for blockers

@JS00001
JS00001 merged commit ff736f2 into Expensify:main Oct 14, 2026
42 of 44 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@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.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/JS00001 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 PR lets you select and copy text inside clickable rows, which is how users already expect the app to behave, and no article under docs/articles says this text can't be copied.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/JS00001 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. This PR lets you select and copy text inside clickable rows, which is how users already expect the app to behave, and no article under docs/articles says this text can't be copied or tells users how to copy it.


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.

8 participants