Skip to content

[$1000] Misleading right-click on email linked to URL #18912

Closed

Description

@kavimuru

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open staging.new.expensify.com
  2. Send an email linked to a URL (e.g. [test@google.com](google.com) )
  3. Right click on the message

Expected Result :

Since the message is an email with a link, the message should be "Copy URL to Clipboard", and after selecting the menu, the URL is copied

Actual Result :

The message is "Copy Email to Clipboard", but after selecting the menu, the URL is copied - this is confusing for the user.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.13.3
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Email.URL.Right.Click.mp4
Recording.608.mp4

Expensify/Expensify Issue URL:
Issue reported by: @kerupuksambel
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1684029611911239

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0185cc75d081384f04
  • Upwork Job ID: 1657974195145203712
  • Last Price Increase: 2023-05-15

Activity

  1. added
    Daily
    Bug
    on May 14, 2023
  2. melvin-bot commented on May 14, 2023

    @melvin-bot

    Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. melvin-bot commented on May 14, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  4. allroundexperts commented on May 14, 2023

    @allroundexperts
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Hyperlinked email still shows Copy email to clipboard menu.

    What is the root cause of that problem?

    The root cause is that we're just checking if the text matches the email pattern and ignoring what the href looks like here.

    What changes do you think we should make in order to solve the problem?

    We can replace this with:

    ReportActionContextMenu.showContextMenu(
                        props.href.indexOf('mailto:') > -1 && Str.isValidEmailMarkdown(props.displayName)
                            ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL
                            : ContextMenuActions.CONTEXT_MENU_TYPES.LINK,
                        event,
                        props.href,
                        lodashGet(linkRef, 'current'),
                    );
    

    What alternative solutions did you explore? (Optional)

    We can also display both Copy email to clipboard and Copy url to clipboard in such cases by creating a new ContextMenuActions.CONTEXT_MENU_TYPES called ContextMenuActions.CONTEXT_MENU_TYPES.BOTH and calling it if href is a url and display text is an email.

  5. eh2077 commented on May 14, 2023

    @eh2077
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Right-click menu on email linked to URL shows Copy email to clipboard.

    What is the root cause of that problem?

    The root cause of this issue is that we determine the type of context menu by props.displayName of BaseAnchorForCommentsOnly here

    Str.isValidEmailMarkdown(props.displayName) ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL : ContextMenuActions.CONTEXT_MENU_TYPES.LINK,

    and props.displayName is the text of anchor tag see here

    const displayName = lodashGet(props.tnode, 'domNode.children[0].data', '');

    which is buggy because

    1. A normal link can also has an email address as the text, like [test@gmail.com](https://google.com)
    2. An email can also has normal text as the text, like [this is an email](test@gmail.com)

    A markdown link

    [test@gmail.com](https://google.com)
    

    is rendered as anchor tag

    <a href="https://google.com" dir="auto" rel="noreferrer noopener" target="_blank" role="link" class="css-text-1rynq56" data-testid="a" style="color: rgb(90, 176, 255); font-size: 15px; text-align: left; font-family: ExpensifyNeue-Regular, &quot;Segoe UI Emoji&quot;, &quot;Noto Color Emoji&quot;; line-height: 20px; text-decoration-line: underline; text-decoration-color: rgb(90, 176, 255); user-select: text;">test@gmail.com</a>

    So, the value of props.displayName for BaseAnchorForCommentsOnly is test@gmail.com and method Str.isValidEmailMarkdown returns true here

    Str.isValidEmailMarkdown(props.displayName) ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL : ContextMenuActions.CONTEXT_MENU_TYPES.LINK,

    That's why right-click menu on email linked to URL shows Copy email to clipboard.

    What changes do you think we should make in order to solve the problem?

    To fix this issue, we can check if the href property of anchor tag is started with mailto: to determine it's an email address. Note that we format anchor tag for email in ExpensiMark.js, see here and here.

    We improve the checking condition here

    Str.isValidEmailMarkdown(props.displayName) ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL : ContextMenuActions.CONTEXT_MENU_TYPES.LINK,

    to

    props.href.startsWith('mailto:') ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL : ContextMenuActions.CONTEXT_MENU_TYPES.LINK,

    Below are useful test cases to verify the solution

    [test@gmail.com](https://google.com)
    
    [this is an email](test@gmail.com)
    
    [test@gmail.com](https://test.com/mailto:)
    

    What alternative solutions did you explore? (Optional)

    N/A

  6. jliexpensify commented on May 15, 2023

    @jliexpensify
    Contributor
  7. changed the title [-]Misleading right-click menu on email linked to URL[/-] [+]Right-clicking an email linked to URL and copying results in only the URL being pasted[/+] on May 15, 2023
  8. changed the title [-]Right-clicking an email linked to URL and copying results in only the URL being pasted[/-] [+]Right-clicking an email linked to URL and copying it results in only the URL being pasted[/+] on May 15, 2023
  9. changed the title [-]Right-clicking an email linked to URL and copying it results in only the URL being pasted[/-] [+]Right-clicking an email linked to URL and copying it results in the incorrect thing being copied[/+] on May 15, 2023
  10. changed the title [-]Right-clicking an email linked to URL and copying it results in the incorrect thing being copied[/-] [+]Misleading right-click on email linked to URL[/+] on May 15, 2023
  11. added
    External
    on May 15, 2023
  12. changed the title [-]Misleading right-click on email linked to URL[/-] [+][$1000] Misleading right-click on email linked to URL[/+] on May 15, 2023
  13. melvin-bot commented on May 15, 2023

    @melvin-bot
  14. 62 remaining items

  15. jliexpensify commented on Jun 9, 2023

    @jliexpensify
    Contributor

    Was there a bug-reporting GH that you can link me to?

  16. eh2077 commented on Jun 9, 2023

    @eh2077
    Contributor

    @jliexpensify Am I eligible for a report bonus for pointing out a related issue about copy email? It's been fixed, see PR comment #19599 (comment) and my proposal.

    @jliexpensify I didn’t file another bug report about it because I was thinking to fix it together in this issue at the beginning. I also mentioned in the slack thread when we first discussed reproduction of the bug, see https://expensify.slack.com/archives/C049HHMV9SM/p1684113923020359?thread_ts=1684029611.911239&cid=C049HHMV9SM.
    I hope the links I included and @fedirjh 's last comment will be helpful for you to evaluate the case, thank you!

  17. jliexpensify commented on Jun 9, 2023

    @jliexpensify
    Contributor

    Thanks for the context, I'm not sure of the process here so I'll surface this internally and get back to you.

  18. melvin-bot commented on Jun 11, 2023

    @melvin-bot

    @allroundexperts @jliexpensify @jasperhuangg @fedirjh this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

    • Decide whether any proposals currently meet our guidelines and can be approved as-is today
    • If no proposals meet that standard, please take this issue internal and treat it as one of your highest priorities
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  19. added
    Internal
    and removed
    External
    on Jun 11, 2023
  20. melvin-bot commented on Jun 11, 2023

    @melvin-bot

    Current assignees @allroundexperts and @fedirjh are eligible for the Internal assigner, not assigning anyone new.

  21. jasperhuangg commented on Jun 12, 2023

    @jasperhuangg
    Contributor

    @fedirjh what are the next steps required for us to close out this issue?

  22. fedirjh commented on Jun 12, 2023

    @fedirjh
    Contributor

    @jasperhuangg We are waiting for @jliexpensify's decision #18912 (comment) to close this issue. Could you please update the title as the checklist is already filled #18912 (comment).

  23. changed the title [-][WAITING ON CHECKLIST] [$1000] Misleading right-click on email linked to URL[/-] [+][$1000] Misleading right-click on email linked to URL[/+] on Jun 13, 2023
  24. jliexpensify commented on Jun 13, 2023

    @jliexpensify
    Contributor

    Apologies, I was OOO yesterday, checking the thread now.

  25. jliexpensify commented on Jun 13, 2023

    @jliexpensify
    Contributor

    @eh2077 - unfortunately we won't be paying you a reporting bonus here: we'll only pay a bug reporter this bonus if they have initially reported it and it's on a GH. This is our process and it's not something we can deviate from, for fairness. We do appreciate your contributions here and that you've gone above and beyond to help us discover additional issues that were fixed.

    In the future, I would encourage you to raise a separate bug report for a GH to be created, this will ensure you'll get the reporting bonus (if applicable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyInternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions