Skip to content

Commit

Permalink
6891 - Add _blank attribute to links on LinkRenderer to open urls on … (
Browse files Browse the repository at this point in the history
#6903)

<!--
Before you open the request please review the following guidelines and
tips to help it be more easily integrated:

 - Describe the scope of your change
Adds target=_blank (with rel=noreferrer) to links generated from
Notes.txt on the LinkRenderer.tsx
 - Describe any known limitations with your change.
This did not include the object link on Line 8. That one seems to be
more internal routing and shouldn't be opened to a new tab, unless you
think otherwise.
- Please run any tests or examples that can exercise your modified code.
1. Add a helm chart that has an external link on the `Notes.txt` and go
to that helm on kubeapps.
2. Click on the link

 Thank you for contributing!
 -->

### Description of the change

Fixes the #6891 ticket

### Benefits

Opens a new tab for external links

### Possible drawbacks
N/A

### Applicable issues

- fixes #6891 

### Additional information
N/A

Signed-off-by: Vash Knives <[email protected]>
  • Loading branch information
vash-knives authored Oct 11, 2023
1 parent 24e5d1a commit a656712
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dashboard/src/components/MarkdownRenderer/LinkRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const LinkRenderer: React.FunctionComponent<{}> = (props: any) => {
}
// If it's not a hash link it's an external link since it's rendering
// the package README. Because of that, render it as a normal anchor
return <a href={props.href}>{props.children}</a>;
return (
<a href={props.href} target="_blank" rel="noreferrer">
{props.children}
</a>
);
};

export default LinkRenderer;

0 comments on commit a656712

Please sign in to comment.