Skip to content

Commit 4bd2421

Browse files
yoonaohjohmsft
andauthored
[DC] Use href and target instead of onClick for opening URLs (#7923)
Co-authored-by: Yoona Oh <[email protected]>
1 parent eaeef97 commit 4bd2421

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

client-react/src/pages/app/deployment-center/bitbucket-provider/DeploymentCenterBitbucketConfiguredView.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const DeploymentCenterBitbucketConfiguredView: React.FC<DeploymentCenterFieldPro
152152
const getBranchLink = () => {
153153
if (!isBranchInfoMissing) {
154154
return (
155-
<Link key="deployment-center-branch-link" onClick={() => window.open(repoUrl, '_blank')} aria-label={`${branch}`}>
155+
<Link key="deployment-center-branch-link" href={repoUrl} target="_blank" aria-label={`${branch}`}>
156156
{`${branch} `}
157157
<Icon id={`branch-button`} iconName={'NavigateExternalInline'} />
158158
</Link>

client-react/src/pages/app/deployment-center/code/DeploymentCenterGitHubActionsCodeLogs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ const DeploymentCenterGitHubActionsCodeLogs: React.FC<DeploymentCenterCodeLogsPr
318318
message: run.head_commit.message,
319319
commit: run.head_commit.id.substr(0, 7),
320320
logSource: (
321-
<Link key="github-actions-logs-link" onClick={() => window.open(run.html_url, '_blank')}>
321+
<Link key="github-actions-logs-link" href={run.html_url} target="_blank">
322322
{t('deploymentCenterBuildDeployLogSource')}
323323
<Icon id={`ga-logs`} iconName={'NavigateExternalInline'} />
324324
</Link>

client-react/src/pages/app/deployment-center/code/DeploymentCenterVSTSCodeLogs.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,7 @@ const DeploymentCenterVSTSCodeLogs: React.FC<DeploymentCenterCodeLogsProps> = pr
164164
{urlInfo.map(info => {
165165
return (
166166
<>
167-
<Link
168-
className={deploymentCenterVstsCodeLogsLinkStyle}
169-
onClick={() => window.open(info.url, '_blank')}
170-
aria-label={info.urlText}>
167+
<Link className={deploymentCenterVstsCodeLogsLinkStyle} href={info.url} target="_blank" aria-label={info.urlText}>
171168
{info.urlIcon && <Icon iconName={info.urlIcon} />}
172169
{info.urlText}
173170
</Link>

client-react/src/pages/app/deployment-center/devops-provider/DeploymentCenterVstsBuildConfiguredView.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ const DeploymentCenterVstsBuildConfiguredView: React.FC<DeploymentCenterFieldPro
9494
return (
9595
<Link
9696
key="deployment-center-branch-link"
97-
onClick={() => window.open(`https://dev.azure.com/${vstsAccountName}/${project}`, '_blank')}
97+
href={`https://dev.azure.com/${vstsAccountName}/${project}`}
98+
target="_blank"
9899
aria-label={project}>
99100
{project}
100101
<Icon id={`repo-button`} iconName={'NavigateExternalInline'} />
@@ -106,7 +107,7 @@ const DeploymentCenterVstsBuildConfiguredView: React.FC<DeploymentCenterFieldPro
106107
const getRepoLink = () => {
107108
if (repoUrl) {
108109
return (
109-
<Link key="deployment-center-branch-link" onClick={() => window.open(repoUrl, '_blank')} aria-label={`${repo}`}>
110+
<Link key="deployment-center-branch-link" href={repoUrl} target="_blank" aria-label={`${repo}`}>
110111
{`${repo} `}
111112
<Icon id={`repo-button`} iconName={'NavigateExternalInline'} />
112113
</Link>

client-react/src/pages/app/deployment-center/external-provider/DeploymentCenterExternalConfiguredView.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const DeploymentCenterExternalConfiguredView: React.FC<DeploymentCenterFieldProp
6969
const getBranchLink = () => {
7070
if (!isBranchInfoMissing) {
7171
return (
72-
<Link key="deployment-center-branch-link" onClick={() => window.open(repo, '_blank')}>
72+
<Link key="deployment-center-branch-link" href={repo} target="_blank">
7373
{`${branch} `}
7474
<Icon id={`branch-button`} iconName={'NavigateExternalInline'} />
7575
</Link>

0 commit comments

Comments
 (0)