Skip to content

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

Open
x-dev90 wants to merge 119 commits into
Expensify:mainfrom
x-dev90:fix/96948-copyable-row-values
Open

Make report, expense, and member values copyable#97277
x-dev90 wants to merge 119 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 makes copy/paste more reliable for values shown inside interactive rows.

The issue is that many amount, report, expense, and member values are rendered inside pressable rows that disable text selection or prevent the mouse-down event needed to start native browser selection. To fix this, this PR adds an opt-in copyable text path and applies it to the issue scope:

Amount and total values
Member names/emails/custom fields
Reports and expenses page values, including report titles, report IDs, grouped headers, and list column values
Expense detail amount values covered by the issue repro

The copyable text path marks selectable values with the shared copyable text marker, applies selectable text styling, and uses shared row press handling so copyable values can start native selection without opening or selecting the row. It also updates SelectionScraper so explicitly copyable values are preserved when copying from rows that are otherwise hidden from copied content.

Fixed Issues

$ #96948
PROPOSAL: #96948 (comment)

Tests

  1. Open an expense detail page.
  2. Drag-select the visible amount value without opening the amount edit step.
  3. Copy and paste the selected value somewhere else.
  4. Verify the copied value matches the visible amount.
  5. Open the workspace members table.
  6. Drag-select a member name, email, or custom field value.
  7. Copy and paste the selected value somewhere else.
  8. Verify the copied value matches the selected member value.
  9. Open the reports/expenses page in Spend.
  10. Drag-select values shown in report/expense list rows, including report titles, report IDs, grouped headers, totals, dates, merchants, categories, and workspace names.
  11. Verify the selected values can be copied without opening the report or expense row.
  12. Repeat the reports/expenses page checks in both narrow and wide layouts.
  13. Click rows normally without selecting text.
  14. Verify row navigation/selection still works.
  • 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.
  • 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 91.52% <ø> (ø)
src/components/AvatarWithDisplayName.tsx 81.00% <100.00%> (+0.19%) ⬆️
src/components/DisplayNames/index.native.tsx 100.00% <100.00%> (ø)
src/components/FormHelpMessage.tsx 91.48% <100.00%> (ø)
...cPressable/implementation/BaseGenericPressable.tsx 81.30% <100.00%> (+0.15%) ⬆️
...c/components/ReportActionItem/MoneyRequestView.tsx 82.62% <100.00%> (+0.55%) ⬆️
src/components/ReportSearchHeader/index.tsx 100.00% <100.00%> (ø)
src/components/Search/ExpenseFlatSearchView.tsx 100.00% <ø> (ø)
src/components/Search/ExpenseReportSearchView.tsx 100.00% <ø> (ø)
.../Search/SearchList/ListItem/BaseListItemHeader.tsx 100.00% <ø> (ø)
... and 50 more
... and 11 files with indirect coverage changes

@x-dev90
x-dev90 marked this pull request as ready for review July 29, 2026 07:59
@x-dev90
x-dev90 requested review from a team as code owners July 29, 2026 07:59
@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/components/TextWithTooltip/selection.ts Outdated
Comment thread src/components/TextWithTooltip/selection.ts Outdated
Comment thread src/libs/SelectionScraper/index.ts Outdated
Comment thread src/components/Search/SearchList/ListItem/TransactionGroupListItem.tsx Outdated

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

Comment thread src/components/MoneyRequestReportView/MoneyRequestReportTransactionItem.tsx Outdated
@x-dev90

x-dev90 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@FitseTLT, gentle bump—thanks!

@JS00001

JS00001 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@FitseTLT can we please try to get this one in

@FitseTLT

Copy link
Copy Markdown
Contributor

Finalizing

}, [helperText, shouldParseHelperText, shouldEscapeText]);

const shouldRenderTitleAsHTML = shouldRenderAsHTML && !!title && Parser.isHTML(title);
const shouldRenderTitleAsHTML = shouldRenderAsHTML && !!title && Parser.hasHTMLTags(title);

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.

Why this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was introduced while fixing descriptions containing &, which were incorrectly interpreted as HTML and became unselectable on mobile web. Parser.isHTML detects both HTML entities and tags, but this rendering path only needs to detect actual HTML tags. I initially used an inline check, then moved the logic to Parser.hasHTMLTags in response to MelvinBot’s feedback.

I explained this in this comment.
thank you!

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.

But that doesn't solve the problem from the root cause because now mark down description is not selectable on mobile.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I addressed this issue. Expense descriptions containing Markdown formatting, such as bold text, are now selectable on mobile web while preserving existing native, desktop, and link-handling behavio:

Screenrecorder-2026-09-12-18-39-32-110.mp4

style={[
styles.flexRow,
StyleUtils.getMenuItemTextContainerStyle(isCompact),
!hasPressableRightComponent && !isTitleSelectable && styles.pointerEventsNone,

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.

What is the purpose of the change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This supports the separate isTitleSelectable behavior introduced following your earlier feedback. During Safari testing, I found that pointerEventsNone prevented selectable titles from receiving native selection gestures, so it is skipped only for opted-in selectable titles. Other MenuItems retain their existing behavior.

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.

Okay but I was confused because it is applied to the badge compoent 😕 ???

Comment thread src/components/ReportActionItem/MoneyRequestView.tsx Outdated
Comment thread src/components/ReportSearchHeader/index.tsx Outdated
Comment thread src/components/ReportActionItem/MoneyRequestView.tsx
Comment thread src/components/Tables/WorkspaceMembersTable/index.tsx
Comment thread src/libs/SelectionScraper/index.ts
Comment thread src/libs/SelectionScraper/index.ts Outdated
@FitseTLT

Copy link
Copy Markdown
Contributor

BUG

2026-09-10.18-42-21.mp4

@JS00001

JS00001 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

conflicts

@x-dev90

x-dev90 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

BUG

2026-09-10.18-42-21.mp4

Addressed by clearing the active text selection before applying a new grouping, preventing it from expanding across the regrouped rows.

Screencast.From.2026-09-11.16-06-46.mp4

@x-dev90

x-dev90 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

@FitseTLT I’ve addressed all your feedback. Could you please review the latest changes? Thank you!

@FitseTLT

Copy link
Copy Markdown
Contributor

@x-dev90 still conflicts

@FitseTLT

Copy link
Copy Markdown
Contributor

BUG: Map is getting copied (and map is selectable on desktop web )

2026-09-11.19-31-05.mp4

@FitseTLT

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 proper code patterns were followed (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 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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • 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 and each prop has a /** comment above it */
    • The file is named correctly
    • 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
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • 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 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 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.
  • 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: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

@x-dev90

x-dev90 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

BUG: Map is getting copied (and map is selectable on desktop web )

2026-09-11.19-31-05.mp4

@FitseTLT, addressed thanks!

Screencast.From.2026-09-11.22-31-24.mp4
Screenrecorder-2026-09-11-22-30-49-272.mp4

@x-dev90

x-dev90 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

The action failure is not related to the code changes in this PR.

@FitseTLT

Copy link
Copy Markdown
Contributor

there are other comments unaddressed

@x-dev90

x-dev90 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

I found and addressed this bug.
Verification steps:

  1. Log in as User B on Android Chrome mWeb.
  2. Open the report shared by User A.
  3. Open the expense details.
  4. Long-press the Attendees name.
  5. Verify native text selection appears and the Expensify “Copy to clipboard” sheet does not open.

Before:

Screen.Recording.2026-09-11.at.6.33.56.PM.mov

After:

Screenrecorder-2026-09-12-09-55-36-360.mp4

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.

7 participants