From a7aea4ba1346d16a1f2c484f7dbf24b2711c53ea Mon Sep 17 00:00:00 2001 From: chichi Date: Thu, 2 Jul 2020 13:21:06 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=5Fblank=20target=EC=9D=98=20Link?= =?UTF-8?q?=EC=97=90=20noopener=EC=9D=84=20=EC=A0=9C=EA=B1=B0=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - noreferrer의사용은 noreferrer noopener을 함께 사용하는 것과 같은 동작을 한다 - ref: https://github.com/yannickcr/eslint-plugin-react/issues/2022 - ref: https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer --- src/core/Link/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/Link/index.tsx b/src/core/Link/index.tsx index 9b6e158c..392b86a4 100644 --- a/src/core/Link/index.tsx +++ b/src/core/Link/index.tsx @@ -21,8 +21,12 @@ export const Link = React.memo( const shouldOpenNewTab = external || props.to.search(httpRegExp) !== -1; + // NOTE: noreferrer의 사용은 noreferrer noopener을 함께 사용하는 것과 같은 동작을 하며 + // https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer + // noreferrer만 사용하는 것이 window.opener 값을 null로 바꾸는 브라우저 테스트에서 더 많이 성공합니다. + // https://github.com/yannickcr/eslint-plugin-react/issues/2022#issuecomment-526320768 const externalAttributes = { - ...(shouldOpenNewTab && { target: '_blank', rel: 'noopener noreferrer' }), + ...(shouldOpenNewTab && { target: '_blank', rel: 'noreferrer' }), }; if (LinkComponent) {