Open external links in new tabs (#731)

* Open external links in new tabs

- allow contact page mailto link opens in new tab
- allow about page mailto link opens in new tab
- comment against opening external links in same tab

* Update snapshots
This commit is contained in:
Vim 2021-09-23 00:22:15 -07:00 committed by GitHub
parent 53c2d98eaa
commit 77a5f179a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 1 deletions

View file

@ -17,6 +17,11 @@ interface ILinkTypeWrapper {
* instance to choose the type of link along with the props necessary to * instance to choose the type of link along with the props necessary to
* set new tabs, classes. * set new tabs, classes.
* *
* Note - if the link is an external link and will not open in a new
* browser tab, ensure that hitting the back button works. This has shown to
* have errors on edge cases (ie, launching the gmail client with mailto links)
* and it is the recommendation to not have external links open in the same tab.
*
* @param props * @param props
* @returns * @returns
*/ */

View file

@ -302,6 +302,8 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
For general feedback, email For general feedback, email
<a <a
href="mailto:screeningtool.feedback@usds.gov" href="mailto:screeningtool.feedback@usds.gov"
rel="noreferrer"
target="_blank"
> >
screeningtool.feedback@usds.gov screeningtool.feedback@usds.gov
</a> </a>

View file

@ -552,6 +552,8 @@ exports[`rendering of the DatasetContainer checks if various text fields are vis
<a <a
class="j40-aboutcard-link" class="j40-aboutcard-link"
href="mailto:screeningtool.feedback@usds.gov" href="mailto:screeningtool.feedback@usds.gov"
rel="noreferrer"
target="_blank"
> >
Email: screeningtool.feedback@usds.gov Email: screeningtool.feedback@usds.gov
</a> </a>

View file

@ -38,7 +38,12 @@ const ContactPage = ({location}: IContactPageProps) => {
defaultMessage={CONTACT_COPY.CONTACT_VIA_EMAIL.DEFAULT_MESSAGE} defaultMessage={CONTACT_COPY.CONTACT_VIA_EMAIL.DEFAULT_MESSAGE}
values={{ values={{
general_email_address: general_email_address:
<a href={`mailto:${CONTACT_COPY.FEEDBACK_EMAIL}`}>{CONTACT_COPY.FEEDBACK_EMAIL}</a>, <a
href={`mailto:${CONTACT_COPY.FEEDBACK_EMAIL}`}
target="_blank"
rel="noreferrer">
{CONTACT_COPY.FEEDBACK_EMAIL}
</a>,
}}/> }}/>
</p> </p>
</Grid> </Grid>

View file

@ -123,6 +123,7 @@ const IndexPage = ({location}: IndexPageProps) => {
header={intl.formatMessage(ABOUT_COPY.GET_INVOLVED.SEND_FEEDBACK_HEADING)} header={intl.formatMessage(ABOUT_COPY.GET_INVOLVED.SEND_FEEDBACK_HEADING)}
linkText={`Email: ${CONTACT_COPY.FEEDBACK_EMAIL}`} linkText={`Email: ${CONTACT_COPY.FEEDBACK_EMAIL}`}
url={`mailto:${CONTACT_COPY.FEEDBACK_EMAIL}`} url={`mailto:${CONTACT_COPY.FEEDBACK_EMAIL}`}
openUrlNewTab={true}
internal={false}> internal={false}>
<p> <p>
{intl.formatMessage(ABOUT_COPY.GET_INVOLVED.SEND_FEEDBACK_INFO)} {intl.formatMessage(ABOUT_COPY.GET_INVOLVED.SEND_FEEDBACK_INFO)}