Link inline component does not navigate to url when clicked

Hi there

I’ve created a UI Kit customfield for Jira that renders a url of another Jira ticket using the Link inline component and although the link is rendering correctly, nothing happens when I click on it.

Is this a bug or must I recreate the field using CustomUI and use a router to navigate to the new link?

I tested with both a relative path and a full path and in both cases, clicking the link does nothing.

My code below

import ForgeUI, { CustomField, render, Text, TextField, useProductContext, Link, useState, Em } from "@forge/ui";
import {getIssueTeamTicket} from "./api";

const View = () => {
    const context = useProductContext();
    const [teamTicket, setTeamTicket] = useState(getIssueTeamTicket(context.platformContext.issueKey));

    if(teamTicket ==null){
        return (
            <CustomField>
                <Text></Text>
            </CustomField>
        );
    }
    else{
        return (
            <CustomField>
                <Text>
                    <Em>Right-click on link below and click 'Open in new tab' to open link</Em>
                </Text>
                <Text>
                    //teamTicket below will be a ticket key, for ex DEM-1.
                    // the url, in this case, resolves to https://<my jira cloud instance>/browse/DEM-1
                    <Link appearance="link" openNewTab={true} href={teamTicket}>
                        {teamTicket}
                    </Link>
                </Text>
            </CustomField>
        );
    }
};

export const runView = render(<View/>);

When you right-click on the link and open it, it opens successfully. I’m also assuming, once the navigation works, the open in new tab will work as well.

I also pasted the example used here and the behaviour is the same. Link renders but no navigation to the url when I click on it.

1 Like

Hi @DeonPetrusMeyer !

Thanks for raising this issue with us. We are aware of that issue - the Link component is a bit tricky here because when you click on field it should enter edit mode, so there are 2 actions which should be performed for the same click - there is already solution for that. It should be solved in next weeks.

Cheers, Kamil

3 Likes

Hello @KamilRichert,

We have a similar issue where we have a ui kit custom field (readonly: true) that we would like to add a link to.

If we add the link, clicking on it does not navigate to the URL however, it does so if you right click on it. We don’t want to make the custom field to be editable but do want to be able to click on links normally.

You mentioned that this was being fixed soon. Can you confirm if this is still something that will be fixed soon and by when? I found this related issue but not sure if this is the issue that is tracking the latest on this.

https://ecosystem.atlassian.net/browse/FRGE-339

Thanks,
Sue

1 Like