diff --git a/core/modules/contextual/js/contextual.es6.js b/core/modules/contextual/js/contextual.es6.js
index 86f76980e2..e06dff69f7 100644
--- a/core/modules/contextual/js/contextual.es6.js
+++ b/core/modules/contextual/js/contextual.es6.js
@@ -98,11 +98,14 @@
       .prepend(Drupal.theme('contextualTrigger'));
 
     // Set the destination parameter on each of the contextual links.
-    const destination = `destination=${Drupal.encodePath(
-      Drupal.url(drupalSettings.path.currentPath),
-    )}`;
     $contextual.find('.contextual-links a').each(function() {
       const url = this.getAttribute('href');
+      if (url.indexOf("delete") >= 0 && url.indexOf("node" ) >= 0){
+        const destination = 'destination=' + Drupal.encodePath(drupalSettings.path.baseUrl);
+      }
+      else{
+        const destination = 'destination=' + Drupal.encodePath(Drupal.url(drupalSettings.path.currentPath));
+      }
       const glue = url.indexOf('?') === -1 ? '?' : '&';
       this.setAttribute('href', url + glue + destination);
     });
diff --git a/core/modules/contextual/js/contextual.js b/core/modules/contextual/js/contextual.js
index 62c9e2c321..019db7f40d 100644
--- a/core/modules/contextual/js/contextual.js
+++ b/core/modules/contextual/js/contextual.js
@@ -54,9 +54,14 @@
     var $region = $contextual.closest('.contextual-region');
     var contextual = Drupal.contextual;
     $contextual.html(html).addClass('contextual').prepend(Drupal.theme('contextualTrigger'));
-    var destination = "destination=".concat(Drupal.encodePath(Drupal.url(drupalSettings.path.currentPath)));
     $contextual.find('.contextual-links a').each(function () {
       var url = this.getAttribute('href');
+      if (url.indexOf("delete") >= 0 && url.indexOf("node" ) >= 0){
+        var destination = 'destination=' + Drupal.encodePath(drupalSettings.path.baseUrl);
+      }
+      else{
+        var destination = 'destination=' + Drupal.encodePath(Drupal.url(drupalSettings.path.currentPath));
+      }
       var glue = url.indexOf('?') === -1 ? '?' : '&';
       this.setAttribute('href', url + glue + destination);
     });
