Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2022-05-20][$1000] Feature Request: Show link when hover over hyperlink #7844

Closed
mvtglobally opened this issue Feb 20, 2022 · 57 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item. Weekly KSv2

Comments

@mvtglobally
Copy link

mvtglobally commented Feb 20, 2022

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. Navigate to chat
  2. Send any text hyperlinked
  3. Hover over or hard press over link

Expected Result:

Some tool tip displayed so that, when the hyperlink is hovered over, the destination link shows.

Actual Result:

Nothing happens on hover

Problem:

Currently users can use markdown to add hyperlinks to chats. The person who receives the link can't easily view the link to know where goes (inc. potential phishing links)

Solution:

Add a tool tip so that, when the hyperlink is hovered over, the destination link shows.

Workaround:

unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.1.39-1
Reproducible in staging?: Y
Reproducible in production?: Y
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
image - 2022-02-20T011335 541

Expensify/Expensify Issue URL:
Issue reported by: @mallenexpensify
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1644366109776009

View all open jobs on GitHub

@mvtglobally mvtglobally added AutoAssignerTriage Auto assign issues for triage to an available triage team member Daily KSv2 labels Feb 20, 2022
@MelvinBot
Copy link

Triggered auto assignment to @kadiealexander (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Feb 20, 2022
@sobitneupane
Copy link
Contributor

PROPOSAL
To achieve this we need to make some changes in src/components/HTMLEngineProvider/HTMLRenderers/AnchorRenderer.js

<AnchorForCommentsOnly
href={attrHref}
isAuthTokenRequired={isAttachment}
// Unless otherwise specified open all links in
// a new window. On Desktop this means that we will
// skip the default Save As... download prompt
// and defer to whatever browser the user has.
// eslint-disable-next-line react/jsx-props-no-multi-spaces
target={htmlAttribs.target || '_blank'}
rel={htmlAttribs.rel || 'noopener noreferrer'}
style={{...props.style, ...parentStyle}}
key={props.key}
fileName={fileName}
>
<TNodeChildrenRenderer tnode={props.tnode} />
</AnchorForCommentsOnly>

<Tooltip text={attrHref}>
    <AnchorForCommentsOnly
        href={attrHref}
        isAuthTokenRequired={isAttachment}

        // Unless otherwise specified open all links in
        // a new window. On Desktop this means that we will
        // skip the default Save As... download prompt
        // and defer to whatever browser the user has.
        // eslint-disable-next-line react/jsx-props-no-multi-spaces
        target={htmlAttribs.target || '_blank'}
        rel={htmlAttribs.rel || 'noopener noreferrer'}
        style={{...props.style, ...parentStyle}}
        key={props.key}
        fileName={fileName}
    >
        <TNodeChildrenRenderer tnode={props.tnode} />
    </AnchorForCommentsOnly>
</Tooltip>

Output:
Screen Shot 2022-02-20 at 14 53 40

@parasharrajat
Copy link
Member

This is an extra feature. it could be good to have but I don't it is needed at this stage.

@kadiealexander
Copy link
Contributor

Agree, but if it's an easy fix I say we go for it. @mallenexpensify is right that it poses a small security risk to click on a link when you're not sure of the destination.

@MelvinBot
Copy link

Triggered auto assignment to @sketchydroide (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@parasharrajat
Copy link
Member

Then I don't think a tooltip is best suited bfor this. Like other websites, hovering over the link the browser should show the link address on the cornor of the browser.

But this is not happening in our app so we should do that even though we are planning to show tooltip.

@sketchydroide
Copy link
Contributor

slack seem to use a tool tip:
Screenshot 2022-02-21 at 12 25 27
Althoug the mobile version doesn't show anything.

I think this is an external

@sketchydroide
Copy link
Contributor

Then I don't think a tooltip is best suited bfor this. Like other websites, hovering over the link the browser should show the link address on the cornor of the browser.

But this is not happening in our app so we should do that even though we are planning to show tooltip.

I think for now let's show the tooltip, this is what slack seems to do, and for the rest of the none web based platforms I think it makes more sense.

@sketchydroide sketchydroide added the External Added to denote the issue can be worked on by a contributor label Feb 21, 2022
@MelvinBot
Copy link

Triggered auto assignment to @mallenexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@sketchydroide
Copy link
Contributor

😄 @mallenexpensify you have been chosen I was goint to tag you, but seems like it is no longer necessary

@parasharrajat
Copy link
Member

But still Tooltips are only web thing.

@mallenexpensify
Copy link
Contributor

Full circle! @parasharrajat is there another term we should use to denote what we're calling/considering a tooltip on Desktop?
image

We definitely want a mobile/app option too, right now there is no way to know where a hyperlink will send you.
IMG_5DAA83E20312-1

How about, when someone taps then holds any link (hyperlinks and other domain links) we show the destination link above or below 'copy URL to clipboard`? Reasoning is because it's possible to use markdown to have a visible link go to a different site
image

Alt option would be to never allow links to go to other sites.

@parasharrajat
Copy link
Member

Sorry for the confusion @mallenexpensify. Tooltip works on both web and desktop but not on the native apps (Android|IOS).

@botify botify removed the Daily KSv2 label Feb 22, 2022
@MelvinBot MelvinBot added the Weekly KSv2 label Feb 22, 2022
@MelvinBot
Copy link

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (Exported)

@MelvinBot MelvinBot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 22, 2022
@MelvinBot
Copy link

Triggered auto assignment to @tgolen (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 27, 2022
@mallenexpensify
Copy link
Contributor

Hired @eVoloshchak and assigned to GH!

@eVoloshchak
Copy link
Contributor

@parasharrajat
I've encountered a problem on Android (haven't tested on iOS yet, but pretty sure it is present there too).
When we have a message with text and a link, long pressing on text will pop up the context menu for the message (which is correct), but long pressing on the link will also pop up the context menu for the message (which is not correct, it should be a context message with Copy URL to clipboard). While if you have a message with just a link, It works correctly.
Here's a video to illustrate

22-04-28-13-14-38.mp4

The issue occurs because if PressableWithSecondaryInteraction is inline, we use Text instead of Pressable and it somehow interferes with LongPressGestureHandler

const Node = props.inline ? Text : Pressable;

I tried to fix this and found out, that if we completely remove LongPressGestureHandler and add onLongPress handler to Node, it works just fine

22-04-28-13-24-49.mp4

So this file would look like

const PressableWithSecondaryInteraction = (props) => {
    // Use Text node for inline mode to prevent content overflow.
    const Node = props.inline ? Text : Pressable;
    return (
        <Node
            ref={props.forwardedRef}
            onPress={props.onPress}
            onPressIn={props.onPressIn}
            onPressOut={props.onPressOut}
            onLongPress={(e) => {
                e.preventDefault();
                HapticFeedback.trigger();
                props.onSecondaryInteraction(e);
            }}
            {...props}
        >
            {props.children}
        </Node>
    );
};

Since you were the author of the PR that introduced this change, I thought you might know more.
Is approach I proposed acceptable?
Do we need LongPressGestureHandler?
I poked around the app and it doesn't seem to break anything, but maybe you have more context
Thanks!

@parasharrajat
Copy link
Member

parasharrajat commented Apr 28, 2022

Hey, @eVoloshchak Thanks for looking into it. It is a different issue than the one we are trying to solve here. So you don't have to fix that in this PR.

we need to use Text for inline mode and we also need the LongPressGestureHandler as it fixes one of the old issues.

but we have a separate logged issue for the problem you mentioned and if you want to solve it, head over to #8311. I am happy to hear the alternatives there.

@eVoloshchak
Copy link
Contributor

Hey, @eVoloshchak Thanks for looking into it. It is a different issue than the one we are trying to solve here. So you don't have to fix that in this PR.

Thanks, go it.

I'm ready to submit the PR, but it's gonna be impossible for the QA to test it for mWeb due to #8311.
Should I submit it or wait for this issue to be resolved?

@parasharrajat
Copy link
Member

You can submit it and we can wait for the other one to be solved. It seems that only you have shared a proposal on the other one.

@melvin-bot
Copy link

melvin-bot bot commented May 3, 2022

@sketchydroide, @tgolen, @eVoloshchak, @mallenexpensify, @parasharrajat Huh... This is 4 days overdue. Who can take care of this?

@parasharrajat
Copy link
Member

PR under review

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels May 4, 2022
@sketchydroide
Copy link
Contributor

no update

@melvin-bot melvin-bot bot removed the Overdue label May 9, 2022
@mallenexpensify mallenexpensify added Weekly KSv2 and removed Daily KSv2 labels May 9, 2022
@mallenexpensify
Copy link
Contributor

This should be a Weekly, updated. The PR is moving along, should hit production soon
#8815

@trjExpensify
Copy link
Contributor

👋 looks like this didn't quite work completely, issue reported with mWeb: #8960 (comment)

@eVoloshchak
Copy link
Contributor

Issue isn't caused by this PR, more details here.

@melvin-bot melvin-bot bot removed the Overdue label May 18, 2022
@mallenexpensify mallenexpensify changed the title [$1000] Feature Request: Show link when hover over hyperlink [HOLD for payment 2022-05-02][$1000] Feature Request: Show link when hover over hyperlink May 20, 2022
@mallenexpensify mallenexpensify added the Awaiting Payment Auto-added when associated PR is deployed to production label May 20, 2022
@mallenexpensify mallenexpensify changed the title [HOLD for payment 2022-05-02][$1000] Feature Request: Show link when hover over hyperlink [HOLD for payment 2022-05-20][$1000] Feature Request: Show link when hover over hyperlink May 20, 2022
@mallenexpensify
Copy link
Contributor

Paid @eVoloshchak , it's working on web and desktop (Version 1.1.64-0). No comments on the PR the past week.

@parasharrajat , hired you for C+ payment, can you accept the offer?

image

image

@parasharrajat
Copy link
Member

@mallenexpensify Done.

@mallenexpensify
Copy link
Contributor

Thanks @parasharrajat , paid $1000 for C+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item. Weekly KSv2
Projects
None yet
Development

No branches or pull requests