Skip to content

Commit 3c6bbae

Browse files
fix: modified link behaviour to improve accessibility (#6284)
1 parent 4159d12 commit 3c6bbae

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

web/core/components/issues/issue-detail/links/link-item.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { FC } from "react";
44
import { observer } from "mobx-react";
5-
import { Pencil, Trash2, LinkIcon, ExternalLink } from "lucide-react";
5+
import { Pencil, Trash2, LinkIcon, Copy } from "lucide-react";
66
import { EIssueServiceType } from "@plane/constants";
77
import { TIssueServiceType } from "@plane/types";
88
// ui
@@ -48,33 +48,33 @@ export const IssueLinkItem: FC<TIssueLinkItem> = observer((props) => {
4848
<div className="flex items-center gap-2.5 truncate flex-grow">
4949
<LinkIcon className="size-4 flex-shrink-0 text-custom-text-400 group-hover:text-custom-text-200" />
5050
<Tooltip tooltipContent={linkDetail.url} isMobile={isMobile}>
51-
<span
51+
<a
52+
href={linkDetail.url}
53+
target="_blank"
54+
rel="noopener noreferrer"
5255
className="truncate text-sm cursor-pointer flex-grow"
53-
onClick={() => {
54-
copyTextToClipboard(linkDetail.url);
55-
setToast({
56-
type: TOAST_TYPE.SUCCESS,
57-
title: "Link copied!",
58-
message: "Link copied to clipboard",
59-
});
60-
}}
6156
>
6257
{linkDetail.title && linkDetail.title !== "" ? linkDetail.title : linkDetail.url}
63-
</span>
58+
</a>
6459
</Tooltip>
6560
</div>
6661
<div className="flex items-center gap-1 flex-shrink-0">
6762
<p className="p-1 text-xs align-bottom leading-5 text-custom-text-400 group-hover-text-custom-text-200">
6863
{calculateTimeAgoShort(linkDetail.created_at)}
6964
</p>
70-
<a
71-
href={linkDetail.url}
72-
target="_blank"
73-
rel="noopener noreferrer"
65+
<span
66+
onClick={() => {
67+
copyTextToClipboard(linkDetail.url);
68+
setToast({
69+
type: TOAST_TYPE.SUCCESS,
70+
title: "Link copied!",
71+
message: "Link copied to clipboard",
72+
});
73+
}}
7474
className="relative grid place-items-center rounded p-1 text-custom-text-400 outline-none group-hover:text-custom-text-200 cursor-pointer hover:bg-custom-background-80"
7575
>
76-
<ExternalLink className="h-3.5 w-3.5 stroke-[1.5]" />
77-
</a>
76+
<Copy className="h-3.5 w-3.5 stroke-[1.5]" />
77+
</span>
7878
<CustomMenu
7979
ellipsis
8080
buttonClassName="text-custom-text-400 group-hover:text-custom-text-200"

web/core/components/modules/links/list-item.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { observer } from "mobx-react";
2-
import { ExternalLink, LinkIcon, Pencil, Trash2 } from "lucide-react";
2+
import { Copy, LinkIcon, Pencil, Trash2 } from "lucide-react";
33
// plane types
44
import { ILinkDetails } from "@plane/types";
55
// plane ui
@@ -45,12 +45,9 @@ export const ModulesLinksListItem: React.FC<Props> = observer((props) => {
4545
<LinkIcon className="h-3 w-3 flex-shrink-0" />
4646
</span>
4747
<Tooltip tooltipContent={link.title && link.title !== "" ? link.title : link.url} isMobile={isMobile}>
48-
<span
49-
className="cursor-pointer truncate text-xs"
50-
onClick={() => copyToClipboard(link.title && link.title !== "" ? link.title : link.url)}
51-
>
48+
<a href={link.url} target="_blank" rel="noopener noreferrer" className="cursor-pointer truncate text-xs">
5249
{link.title && link.title !== "" ? link.title : link.url}
53-
</span>
50+
</a>
5451
</Tooltip>
5552
</div>
5653

@@ -68,14 +65,12 @@ export const ModulesLinksListItem: React.FC<Props> = observer((props) => {
6865
<Pencil className="size-3 stroke-[1.5] text-custom-text-200" />
6966
</button>
7067
)}
71-
<a
72-
href={link.url}
73-
target="_blank"
74-
rel="noopener noreferrer"
75-
className="grid place-items-center p-1 hover:bg-custom-background-80"
68+
<span
69+
onClick={() => copyToClipboard(link.title && link.title !== "" ? link.title : link.url)}
70+
className="grid place-items-center p-1 hover:bg-custom-background-80 cursor-pointer"
7671
>
77-
<ExternalLink className="size-3 stroke-[1.5] text-custom-text-200" />
78-
</a>
72+
<Copy className="h-3.5 w-3.5 stroke-[1.5]" />
73+
</span>
7974
{isEditingAllowed && (
8075
<button
8176
type="button"

0 commit comments

Comments
 (0)