Skip to content

Commit

Permalink
[DC] Use href and target instead of onClick for opening URLs (#7923)
Browse files Browse the repository at this point in the history
Co-authored-by: Yoona Oh <[email protected]>
  • Loading branch information
2 people authored and shimedh committed Dec 3, 2024
1 parent d0b2285 commit 5b1f8a7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const DeploymentCenterBitbucketConfiguredView: React.FC<DeploymentCenterFieldPro
const getBranchLink = () => {
if (!isBranchInfoMissing) {
return (
<Link key="deployment-center-branch-link" onClick={() => window.open(repoUrl, '_blank')} aria-label={`${branch}`}>
<Link key="deployment-center-branch-link" href={repoUrl} target="_blank" aria-label={`${branch}`}>
{`${branch} `}
<Icon id={`branch-button`} iconName={'NavigateExternalInline'} />
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ const DeploymentCenterGitHubActionsCodeLogs: React.FC<DeploymentCenterCodeLogsPr
message: run.head_commit.message,
commit: run.head_commit.id.substr(0, 7),
logSource: (
<Link key="github-actions-logs-link" onClick={() => window.open(run.html_url, '_blank')}>
<Link key="github-actions-logs-link" href={run.html_url} target="_blank">
{t('deploymentCenterBuildDeployLogSource')}
<Icon id={`ga-logs`} iconName={'NavigateExternalInline'} />
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,7 @@ const DeploymentCenterVSTSCodeLogs: React.FC<DeploymentCenterCodeLogsProps> = pr
{urlInfo.map(info => {
return (
<>
<Link
className={deploymentCenterVstsCodeLogsLinkStyle}
onClick={() => window.open(info.url, '_blank')}
aria-label={info.urlText}>
<Link className={deploymentCenterVstsCodeLogsLinkStyle} href={info.url} target="_blank" aria-label={info.urlText}>
{info.urlIcon && <Icon iconName={info.urlIcon} />}
{info.urlText}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ const DeploymentCenterVstsBuildConfiguredView: React.FC<DeploymentCenterFieldPro
return (
<Link
key="deployment-center-branch-link"
onClick={() => window.open(`https://dev.azure.com/${vstsAccountName}/${project}`, '_blank')}
href={`https://dev.azure.com/${vstsAccountName}/${project}`}
target="_blank"
aria-label={project}>
{project}
<Icon id={`repo-button`} iconName={'NavigateExternalInline'} />
Expand All @@ -106,7 +107,7 @@ const DeploymentCenterVstsBuildConfiguredView: React.FC<DeploymentCenterFieldPro
const getRepoLink = () => {
if (repoUrl) {
return (
<Link key="deployment-center-branch-link" onClick={() => window.open(repoUrl, '_blank')} aria-label={`${repo}`}>
<Link key="deployment-center-branch-link" href={repoUrl} target="_blank" aria-label={`${repo}`}>
{`${repo} `}
<Icon id={`repo-button`} iconName={'NavigateExternalInline'} />
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const DeploymentCenterExternalConfiguredView: React.FC<DeploymentCenterFieldProp
const getBranchLink = () => {
if (!isBranchInfoMissing) {
return (
<Link key="deployment-center-branch-link" onClick={() => window.open(repo, '_blank')}>
<Link key="deployment-center-branch-link" href={repo} target="_blank">
{`${branch} `}
<Icon id={`branch-button`} iconName={'NavigateExternalInline'} />
</Link>
Expand Down

0 comments on commit 5b1f8a7

Please sign in to comment.