App: [Pay Aug 18 if no regressions] Copy to clipboard - Unable to copy images or links
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Expected Result:
- User should be able to copy images and link URLs when using the copy to clipboard feature.
- Right-clicking or long-pressing on a link should open the
ReportActionContextMenu, but theCopy to Clipboardmenu item should instead sayCopy URL to Clipboard. Pressing that menu item, the link url should be copied to the clipboard. - Right-clicking or long-pressing on an image should open the
ReportActionContextMenu, but theCopy to Clipboardmenu should instead sayCopy Image to Clipboard. Pressing that menu item, the image should be copied to the clipboard.
Actual Result:
When copying and pasting an image, the HTML coding is displayed instead of the link or image.
Action Performed:
- Log in to e.cash and navigate to a conversation
- Click on add attachment
- Upload a picture
- RIght click the message with the image
- Click on copy to clipboard
- Paste the image on a text input
Workaround:
No way of copying an image by using copy to clipboard.
Platform:
Where is this issue occurring?
Web ✔️ iOS ✔️ Android ✔️ Desktop App ✔️ Mobile Web ✔️
Version Number: 1.0.60-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

Expensify/Expensify Issue URL:
From @iwiznia https://expensify.slack.com/archives/C01GTK53T8Q/p1622579145427200
we sequester the right click button to show the actions menu, but that makes it impossible to copy a link that’s in a comment or being able to copy an image pasted.
Upwork job: https://www.upwork.com/jobs/~015ed0068d5788ef5a
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 31 (29 by maintainers)
Thanks @aliabbasmalik8, but I think we’re going to move forward with @Drewfergusson on this issue for now. @puneetlath Will you please hire @Drewfergusson on Upwork?
Yeah, as stated in this comment and the previous one, @Drewfergusson only worked on the portion of this issue related to copying links, but he also set up a really easily extensible framework to display different types of context menus depending on what was interacted with.
So we need to follow-up on this issue with part 2. I created a separate issue over here: https://github.com/Expensify/App/issues/4629
Hey, @puneetlath @roryabraham I was working on testing the solution I came up with and ran into an issue with what I proposed.
In my proposal, I am essentially creating a reusable component to wrap some “thing” (in this case the link) with a react native Pressable component . This special Pressable then triggers a Popover. This works fine on browser, desktop, and mobile web. (PR here)
For mobile though, links at their core have a Text element with an onPress attribute. It seems that on mobile, events are not propagating out as they do in a browser normally. (or something is preventing this that I don’t know of). If I remove the onPress attribute from the Text component, wrapping it with the special Pressable I created works fine. As soon as I add back the onPress attribute then wrapping does not propagate onPress nor onLongPress events. It seems like the same Text component or Pressable component will have to have to have the onLongPress and on onPress attributes. It will not be as cleanly composable as I first thought.
Still working on a nice solution on the mobile side and should have an update soon. Let me know if anything comes to mind.
@puneetlath I submitted my proposal with the name Andrew Michael Ferguson. It was a couple of days ago so you may have to look. Not sure if this link works for you but this is the link where I can view my proposal. https://www.upwork.com/ab/proposals/1409996432714612737
Hm, @roryabraham @iwiznia @parasharrajat I think a few different issues are being conflated here. The original issue reported here was that when you copy a message that contains an image, it puts the raw html on your clipboard instead of just the image. This also was happening with messages that contained links, but isn’t anymore (I had already removed @isagoico’s screenshot that showed it).
I think we should split up what y’all are saying into separate issues and implement it slightly differently.
That’s how I’d implement this. And I’d do it in two different issues. What do y’all think?
I think that’s not what the issue meant.
Try
this is a message with link https://google.comNow try to copy the link only.Hm, it’s working for me on desktop on staging for links.