diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php
index 1ad5271..b5aef7b 100644
--- a/core/modules/menu_ui/src/MenuForm.php
+++ b/core/modules/menu_ui/src/MenuForm.php
@@ -381,7 +381,7 @@ protected function buildOverviewTreeForm($tree, $delta) {
         if ($edit_route) {
           $operations['edit']['url'] = $edit_route;
           // Bring the user back to the menu overview.
-          $operations['edit']['query']['destination'] = $this->entity->url();
+          $operations['edit']['query'] = drupal_get_destination();
         }
         else {
           // Fall back to the standard edit link.
@@ -398,7 +398,7 @@ protected function buildOverviewTreeForm($tree, $delta) {
         }
         elseif ($delete_link = $link->getDeleteRoute()) {
           $operations['delete']['url'] = $delete_link;
-          $operations['delete']['query']['destination'] = $this->entity->url();
+          $operations['delete']['query'] = drupal_get_destination();
           $operations['delete']['title'] = $this->t('Delete');
         }
         if ($link->isTranslatable()) {
diff --git a/core/modules/menu_ui/src/Plugin/Menu/LocalAction/MenuLinkAdd.php b/core/modules/menu_ui/src/Plugin/Menu/LocalAction/MenuLinkAdd.php
index f4e04fe..e20a181 100644
--- a/core/modules/menu_ui/src/Plugin/Menu/LocalAction/MenuLinkAdd.php
+++ b/core/modules/menu_ui/src/Plugin/Menu/LocalAction/MenuLinkAdd.php
@@ -22,9 +22,7 @@ class MenuLinkAdd extends LocalActionDefault {
   public function getOptions(RouteMatchInterface $route_match) {
     $options = parent::getOptions($route_match);
     // Append the current path as destination to the query string.
-    if ($route_name = $route_match->getRouteName()) {
-      $options['query']['destination'] = Url::fromRoute($route_name, $route_match->getRawParameters()->all())->toString();
-    }
+    $options['query']['destination'] = drupal_get_destination()['destination'];
     return $options;
   }
 
diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php
index e33e53a..94ca8a2 100644
--- a/core/modules/menu_ui/src/Tests/MenuTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuTest.php
@@ -260,6 +260,25 @@ function deleteCustomMenu() {
    */
   function doMenuTests() {
     $menu_name = $this->menu->id();
+
+    // Test the 'Add link' local action.
+    $this->drupalGet('admin/structure/menu/manage/' . $menu_name);
+    $this->clickLink(t('Add link'));
+    $link_title = $this->randomString();
+    $this->drupalPostForm(NULL, array('url' => '<front>', 'title[0][value]' => $link_title), t('Save'));
+    $this->assertUrl('admin/structure/menu/manage/' . $menu_name);
+    // Test the 'Edit' operation.
+    $this->clickLink(t('Edit'));
+    $this->assertFieldByName('title[0][value]', $link_title);
+    $link_title = $this->randomString();
+    $this->drupalPostForm(NULL, array('title[0][value]' => $link_title), t('Save'));
+    $this->assertUrl('admin/structure/menu/manage/' . $menu_name);
+    // Test the 'Delete' operation.
+    $this->clickLink(t('Delete'));
+    $this->assertRaw(t('Are you sure you want to delete the custom menu link %item?', array('%item' => $link_title)));
+    $this->drupalPostForm(NULL, array(), t('Confirm'));
+    $this->assertUrl('admin/structure/menu/manage/' . $menu_name);
+
     // Add nodes to use as links for menu links.
     $node1 = $this->drupalCreateNode(array('type' => 'article'));
     $node2 = $this->drupalCreateNode(array('type' => 'article'));
