diff --git a/warehouse/static/js/warehouse/index.js b/warehouse/static/js/warehouse/index.js
index <HASH>..<HASH> 100644
--- a/warehouse/static/js/warehouse/index.js
+++ b/warehouse/static/js/warehouse/index.js
@@ -104,6 +104,20 @@ docReady(() => {
   });
 });
 
+// Close modals when escape button is pressed
+docReady(() => {
+  document.addEventListener("keydown", event => {
+    if (event.keyCode === 27) {
+      window.location.href = "#modal-close";
+      for (let element of document.querySelectorAll(".modal")) {
+        application
+          .getControllerForElementAndIdentifier(element, "confirm")
+          .cancel();
+      }
+    }
+  });
+});
+
 // Position sticky bar
 docReady(() => {
   setTimeout(PositionWarning, 200);
Exit modals by pressing escape button (#<I>)

* working on #<I>



* enhancement - close modals when escape button is pressed