diff --git a/frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx b/frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx
index e1187d42db7ce2cfb3ce5d09b63933ef4d704f83..baf590adbcfd9a813a54eb3c6ccbb3a810172aed 100644
--- a/frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx
+++ b/frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx
@@ -177,9 +177,14 @@ export default class NativeQueryEditor extends Component {
   }, 100);
 
   handleKeyDown = e => {
-    const ENTER_KEY = 13;
-    if (e.keyCode === ENTER_KEY && (e.metaKey || e.ctrlKey)) {
-      this.runQuery();
+    const { isRunning, cancelQuery } = this.props;
+
+    if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
+      if (isRunning) {
+        cancelQuery();
+      } else {
+        this.runQuery();
+      }
     }
   };
 
diff --git a/frontend/test/metabase/scenarios/visualizations/reproductions/11727-cancel-native-query-shortcut.cy.spec.js b/frontend/test/metabase/scenarios/visualizations/reproductions/11727-cancel-native-query-shortcut.cy.spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..6239daf6851980fc6db6862eddaf75d4b02cdd77
--- /dev/null
+++ b/frontend/test/metabase/scenarios/visualizations/reproductions/11727-cancel-native-query-shortcut.cy.spec.js
@@ -0,0 +1,38 @@
+import {
+  restore,
+  withDatabase,
+  adhocQuestionHash,
+} from "__support__/e2e/cypress";
+
+const PG_DB_ID = 2;
+
+const questionDetails = {
+  dataset_query: {
+    type: "native",
+    database: PG_DB_ID,
+    native: {
+      query: "SELECT pg_sleep(10)",
+    },
+  },
+};
+
+describe("issue 11727", () => {
+  beforeEach(() => {
+    restore("postgres-12");
+    cy.signInAsAdmin();
+    cy.intercept("GET", "/api/database").as("getDatabases");
+  });
+
+  it("should cancel the native query via the keyboard shortcut (metabase#11727)", () => {
+    withDatabase(PG_DB_ID, () => {
+      cy.visit(`/question#` + adhocQuestionHash(questionDetails));
+      cy.wait("@getDatabases");
+
+      cy.findByText("Doing science...").should("be.visible");
+      cy.get("body").type("{cmd}{enter}");
+      cy.findByText("Here's where your results will appear").should(
+        "be.visible",
+      );
+    });
+  });
+});