Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t prevent the browser’s default behavior for Alt key #16003

Merged
merged 4 commits into from
Aug 10, 2020
Merged

Don’t prevent the browser’s default behavior for Alt key #16003

merged 4 commits into from
Aug 10, 2020

Conversation

yuheiy
Copy link
Contributor

@yuheiy yuheiy commented Aug 8, 2020

In most browsers, clicking links with the Alt key has a special behavior, for example, Chrome downloads the target resource. As with other modifier keys, the router should stop the original navigation to avoid preventing the browser’s default behavior.

When users click a link while holding the Alt key together, the browsers behave as follows.

Windows 10:

Browser Behavior
Chrome 84 Download the target resource
Firefox 79 Prevent navigation and therefore do nothing
Edge 84 Download the target resource
IE 11 No impact

macOS Catalina:

Browser Behavior
Chrome 84 Download the target resource
Firefox 79 Prevent navigation and therefore do nothing
Safari 13 Download the target resource

yuheiy added 2 commits August 8, 2020 23:56
In most browsers, clicking links with the Alt key has a special behavior, for example, Chrome
downloads the target resource. As with other modifier keys, the router should stop the original
navigation to avoid preventing the browser’s default behavior.

When users click a link while holding the Alt key together, the browsers behave as follows.

Windows 10:

| Browser    | Behavior                                    |
|:-----------|:--------------------------------------------|
| Chrome 84  | Download the target resource                |
| Firefox 79 | Prevent navigation and therefore do nothing |
| Edge 84    | Download the target resource                |
| IE 11      | No impact                                   |

macOS Catalina:

| Browser    | Behavior                                    |
|:-----------|:--------------------------------------------|
| Chrome 84  | Download the target resource                |
| Firefox 79 | Prevent navigation and therefore do nothing |
| Safari 13  | Download the target resource                |
@ijjk
Copy link
Member

ijjk commented Aug 8, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
buildDuration 13s 13.3s ⚠️ +215ms
nodeModulesSize 66 MB 66 MB ⚠️ +64 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
/ failed reqs 0 0
/ total time (seconds) 2.423 2.499 ⚠️ +0.08
/ avg req/sec 1031.98 1000.46 ⚠️ -31.52
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.41 1.395 -0.01
/error-in-render avg req/sec 1772.85 1791.91 +19.06
Client Bundles (main, webpack, commons)
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..ec1a.js gzip 9.99 kB 9.99 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-008324e..83e7.js gzip 6.74 kB 6.74 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..dule.js gzip 5.89 kB 5.89 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-c621fe2..dule.js gzip 5.81 kB 5.81 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary yuheiy/next.js alt-key Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB 1.29 kB ⚠️ +3 B
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
Overall change 7.71 kB 7.71 kB ⚠️ +3 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB 1.26 kB ⚠️ +3 B
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
Overall change 5.37 kB 5.37 kB ⚠️ +3 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary yuheiy/next.js alt-key Change
_buildManifest.js gzip 273 B 271 B -2 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 550 B -3 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
index.html gzip 948 B 948 B
link.html gzip 954 B 955 B ⚠️ +1 B
withRouter.html gzip 941 B 941 B
Overall change 2.84 kB 2.84 kB ⚠️ +1 B

Diffs

Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
   ],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-39e004206883f7d406ca.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-caa8be9f2c1e3fea8753.js"],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
   ],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
   ],
   "/link": [
-    "static\u002Fchunks\u002Fpages\u002Flink-e9ad83832d32f405f5bb.module.js"
+    "static\u002Fchunks\u002Fpages\u002Flink-5a7c12ae40a68acd0a03.module.js"
   ],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-39e0042..3f7d406ca.js
@@ -155,13 +155,14 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         prefetched[href + "%" + as] = true;
       }
 
-      function isNewTabRequest(event) {
+      function isModifiedEvent(event) {
         var target = event.currentTarget.target;
         return (
           (target && target !== "_self") ||
           event.metaKey ||
           event.ctrlKey ||
           event.shiftKey ||
+          event.altKey ||
           (event.nativeEvent && event.nativeEvent.which === 2)
         );
       }
@@ -171,9 +172,9 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
         if (
           nodeName === "A" &&
-          (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
+          (isModifiedEvent(e) || !(0, _router.isLocalURL)(href))
         ) {
-          // ignore click for new tab / new window behavior
+          // ignore click for browser’s default behavior
           return;
         }
Diff for link-e9ad838..bb.module.js
@@ -151,13 +151,14 @@
         prefetched[href + "%" + as] = true;
       }
 
-      function isNewTabRequest(event) {
+      function isModifiedEvent(event) {
         var { target } = event.currentTarget;
         return (
           (target && target !== "_self") ||
           event.metaKey ||
           event.ctrlKey ||
           event.shiftKey ||
+          event.altKey ||
           (event.nativeEvent && event.nativeEvent.which === 2)
         );
       }
@@ -167,9 +168,9 @@
 
         if (
           nodeName === "A" &&
-          (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
+          (isModifiedEvent(e) || !(0, _router.isLocalURL)(href))
         ) {
-          // ignore click for new tab / new window behavior
+          // ignore click for browser’s default behavior
           return;
         }
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      href="/_next/static/chunks/pages/link-5a7c12ae40a68acd0a03.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -146,13 +146,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-39e004206883f7d406ca.js"
+      src="/_next/static/chunks/pages/link-caa8be9f2c1e3fea8753.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      src="/_next/static/chunks/pages/link-5a7c12ae40a68acd0a03.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
buildDuration 14.5s 14.6s ⚠️ +103ms
nodeModulesSize 66 MB 66 MB ⚠️ +64 B
Client Bundles (main, webpack, commons)
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..ec1a.js gzip 9.99 kB 9.99 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-008324e..83e7.js gzip 6.74 kB 6.74 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..dule.js gzip 5.89 kB 5.89 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-c621fe2..dule.js gzip 5.81 kB 5.81 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary yuheiy/next.js alt-key Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB N/A N/A
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
link-b69b486..3677.js gzip N/A 1.29 kB N/A
Overall change 7.71 kB 7.71 kB ⚠️ +3 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB N/A N/A
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
link-cb30123..dule.js gzip N/A 1.26 kB N/A
Overall change 5.37 kB 5.37 kB ⚠️ +3 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary yuheiy/next.js alt-key Change
_buildManifest.js gzip 273 B 271 B -2 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 550 B -3 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_error.js 1.03 MB 1.03 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.03 MB 1.03 MB
link.js 1.07 MB 1.07 MB ⚠️ +15 B
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.26 MB 5.26 MB ⚠️ +15 B
Commit: 3c96ec5

const { target } = event.currentTarget as HTMLAnchorElement
return (
(target && target !== '_self') ||
event.metaKey ||
event.ctrlKey ||
event.shiftKey ||
event.altKey ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment explaining this triggers resource download?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added.

@ijjk
Copy link
Member

ijjk commented Aug 8, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
buildDuration 12.9s 12.8s -93ms
nodeModulesSize 66 MB 66 MB ⚠️ +130 B
Page Load Tests Overall increase ✓
vercel/next.js canary yuheiy/next.js alt-key Change
/ failed reqs 0 0
/ total time (seconds) 2.274 2.246 -0.03
/ avg req/sec 1099.32 1113.25 +13.93
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.265 1.26 0
/error-in-render avg req/sec 1975.66 1983.42 +7.76
Client Bundles (main, webpack, commons)
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..ec1a.js gzip 9.99 kB 9.99 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-008324e..83e7.js gzip 6.74 kB 6.74 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..dule.js gzip 5.89 kB 5.89 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-c621fe2..dule.js gzip 5.81 kB 5.81 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary yuheiy/next.js alt-key Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB 1.29 kB ⚠️ +3 B
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
Overall change 7.71 kB 7.71 kB ⚠️ +3 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB 1.26 kB ⚠️ +3 B
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
Overall change 5.37 kB 5.37 kB ⚠️ +3 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary yuheiy/next.js alt-key Change
_buildManifest.js gzip 273 B 273 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 552 B -1 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
index.html gzip 948 B 948 B
link.html gzip 954 B 955 B ⚠️ +1 B
withRouter.html gzip 941 B 941 B
Overall change 2.84 kB 2.84 kB ⚠️ +1 B

Diffs

Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
   ],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-39e004206883f7d406ca.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-3e536e855e7143324b04.js"],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
   ],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
   ],
   "/link": [
-    "static\u002Fchunks\u002Fpages\u002Flink-e9ad83832d32f405f5bb.module.js"
+    "static\u002Fchunks\u002Fpages\u002Flink-6fa73e7e8736497268e2.module.js"
   ],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-39e0042..3f7d406ca.js
@@ -155,13 +155,14 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         prefetched[href + "%" + as] = true;
       }
 
-      function isNewTabRequest(event) {
+      function isModifiedEvent(event) {
         var target = event.currentTarget.target;
         return (
           (target && target !== "_self") ||
           event.metaKey ||
           event.ctrlKey ||
           event.shiftKey ||
+          event.altKey || // triggers resource download
           (event.nativeEvent && event.nativeEvent.which === 2)
         );
       }
@@ -171,9 +172,9 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
         if (
           nodeName === "A" &&
-          (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
+          (isModifiedEvent(e) || !(0, _router.isLocalURL)(href))
         ) {
-          // ignore click for new tab / new window behavior
+          // ignore click for browser’s default behavior
           return;
         }
Diff for link-e9ad838..bb.module.js
@@ -151,13 +151,14 @@
         prefetched[href + "%" + as] = true;
       }
 
-      function isNewTabRequest(event) {
+      function isModifiedEvent(event) {
         var { target } = event.currentTarget;
         return (
           (target && target !== "_self") ||
           event.metaKey ||
           event.ctrlKey ||
           event.shiftKey ||
+          event.altKey || // triggers resource download
           (event.nativeEvent && event.nativeEvent.which === 2)
         );
       }
@@ -167,9 +168,9 @@
 
         if (
           nodeName === "A" &&
-          (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
+          (isModifiedEvent(e) || !(0, _router.isLocalURL)(href))
         ) {
-          // ignore click for new tab / new window behavior
+          // ignore click for browser’s default behavior
           return;
         }
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      href="/_next/static/chunks/pages/link-6fa73e7e8736497268e2.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -146,13 +146,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-39e004206883f7d406ca.js"
+      src="/_next/static/chunks/pages/link-3e536e855e7143324b04.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      src="/_next/static/chunks/pages/link-6fa73e7e8736497268e2.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
buildDuration 14s 13.8s -173ms
nodeModulesSize 66 MB 66 MB ⚠️ +130 B
Client Bundles (main, webpack, commons)
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..ec1a.js gzip 9.99 kB 9.99 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-008324e..83e7.js gzip 6.74 kB 6.74 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..dule.js gzip 5.89 kB 5.89 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-c621fe2..dule.js gzip 5.81 kB 5.81 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary yuheiy/next.js alt-key Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB N/A N/A
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
link-4c2bd9b..eadd.js gzip N/A 1.29 kB N/A
Overall change 7.71 kB 7.71 kB ⚠️ +3 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB N/A N/A
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
link-236a801..dule.js gzip N/A 1.26 kB N/A
Overall change 5.37 kB 5.37 kB ⚠️ +3 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary yuheiy/next.js alt-key Change
_buildManifest.js gzip 273 B 273 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 552 B -1 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_error.js 1.03 MB 1.03 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.03 MB 1.03 MB
link.js 1.07 MB 1.07 MB ⚠️ +47 B
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.26 MB 5.26 MB ⚠️ +47 B
Commit: a40328c

Copy link
Member

@Timer Timer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@ijjk
Copy link
Member

ijjk commented Aug 10, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
buildDuration 12.3s 12.5s ⚠️ +143ms
nodeModulesSize 57.2 MB 57.2 MB ⚠️ +130 B
Page Load Tests Overall increase ✓
vercel/next.js canary yuheiy/next.js alt-key Change
/ failed reqs 0 0
/ total time (seconds) 2.203 2.171 -0.03
/ avg req/sec 1134.71 1151.54 +16.83
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.288 1.202 -0.09
/error-in-render avg req/sec 1941.32 2079.7 +138.38
Client Bundles (main, webpack, commons)
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..6aa6.js gzip 10 kB 10 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-702c669..14cc.js gzip 6.72 kB 6.72 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..dule.js gzip 5.92 kB 5.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-4ed816f..dule.js gzip 5.79 kB 5.79 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary yuheiy/next.js alt-key Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB 1.29 kB ⚠️ +3 B
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
Overall change 7.71 kB 7.71 kB ⚠️ +3 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB 1.26 kB ⚠️ +3 B
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
Overall change 5.37 kB 5.37 kB ⚠️ +3 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary yuheiy/next.js alt-key Change
_buildManifest.js gzip 273 B 273 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 552 B -1 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
index.html gzip 946 B 946 B
link.html gzip 952 B 954 B ⚠️ +2 B
withRouter.html gzip 940 B 940 B
Overall change 2.84 kB 2.84 kB ⚠️ +2 B

Diffs

Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
   ],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-39e004206883f7d406ca.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-3e536e855e7143324b04.js"],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
   ],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
   ],
   "/link": [
-    "static\u002Fchunks\u002Fpages\u002Flink-e9ad83832d32f405f5bb.module.js"
+    "static\u002Fchunks\u002Fpages\u002Flink-6fa73e7e8736497268e2.module.js"
   ],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-39e0042..3f7d406ca.js
@@ -155,13 +155,14 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         prefetched[href + "%" + as] = true;
       }
 
-      function isNewTabRequest(event) {
+      function isModifiedEvent(event) {
         var target = event.currentTarget.target;
         return (
           (target && target !== "_self") ||
           event.metaKey ||
           event.ctrlKey ||
           event.shiftKey ||
+          event.altKey || // triggers resource download
           (event.nativeEvent && event.nativeEvent.which === 2)
         );
       }
@@ -171,9 +172,9 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
         if (
           nodeName === "A" &&
-          (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
+          (isModifiedEvent(e) || !(0, _router.isLocalURL)(href))
         ) {
-          // ignore click for new tab / new window behavior
+          // ignore click for browser’s default behavior
           return;
         }
Diff for link-e9ad838..bb.module.js
@@ -151,13 +151,14 @@
         prefetched[href + "%" + as] = true;
       }
 
-      function isNewTabRequest(event) {
+      function isModifiedEvent(event) {
         var { target } = event.currentTarget;
         return (
           (target && target !== "_self") ||
           event.metaKey ||
           event.ctrlKey ||
           event.shiftKey ||
+          event.altKey || // triggers resource download
           (event.nativeEvent && event.nativeEvent.which === 2)
         );
       }
@@ -167,9 +168,9 @@
 
         if (
           nodeName === "A" &&
-          (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
+          (isModifiedEvent(e) || !(0, _router.isLocalURL)(href))
         ) {
-          // ignore click for new tab / new window behavior
+          // ignore click for browser’s default behavior
           return;
         }
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      href="/_next/static/chunks/pages/link-6fa73e7e8736497268e2.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -146,13 +146,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-39e004206883f7d406ca.js"
+      src="/_next/static/chunks/pages/link-3e536e855e7143324b04.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      src="/_next/static/chunks/pages/link-6fa73e7e8736497268e2.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
buildDuration 13.6s 13.5s -100ms
nodeModulesSize 57.2 MB 57.2 MB ⚠️ +130 B
Client Bundles (main, webpack, commons)
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..6aa6.js gzip 10 kB 10 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-702c669..14cc.js gzip 6.72 kB 6.72 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary yuheiy/next.js alt-key Change
677f882d2ed8..dule.js gzip 5.92 kB 5.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-4ed816f..dule.js gzip 5.79 kB 5.79 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary yuheiy/next.js alt-key Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB N/A N/A
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
link-4c2bd9b..eadd.js gzip N/A 1.29 kB N/A
Overall change 7.71 kB 7.71 kB ⚠️ +3 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB N/A N/A
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
link-236a801..dule.js gzip N/A 1.26 kB N/A
Overall change 5.37 kB 5.37 kB ⚠️ +3 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary yuheiy/next.js alt-key Change
_buildManifest.js gzip 273 B 273 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 552 B -1 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary yuheiy/next.js alt-key Change
_error.js 1.03 MB 1.03 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.03 MB 1.03 MB
link.js 1.07 MB 1.07 MB ⚠️ +47 B
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.26 MB 5.26 MB ⚠️ +47 B
Commit: 7955bb8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants