From 1b5a56b5f64c5a55817b6c63634eb185b0e01997 Mon Sep 17 00:00:00 2001
From: sai-chand04 <65910693+sai-chand04@users.noreply.github.com>
Date: Thu, 25 Jul 2024 16:42:48 +0530
Subject: [PATCH] Restore close and shutdown confirmation dialog

---
 packages/notebook-extension/src/index.ts | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts
index ca1f2e89e7..54127083ae 100644
--- a/packages/notebook-extension/src/index.ts
+++ b/packages/notebook-extension/src/index.ts
@@ -163,9 +163,15 @@ const closeTab: JupyterFrontEndPlugin<void> = {
     commands.addCommand(id, {
       label: trans.__('Close and Shut Down Notebook'),
       execute: async () => {
-        // Shut the kernel down, without confirmation
-        await commands.execute('notebook:shutdown-kernel', { activate: false });
-        window.close();
+        const confirm = window.confirm(
+          trans.__('Are you sure you want to close and shut down the notebook?')
+        );
+        if (confirm) {
+          await commands.execute('notebook:shutdown-kernel', {
+            activate: false,
+          });
+          window.close();
+        }
       },
     });
     menu.fileMenu.closeAndCleaners.add({