diff --git a/core/modules/views_ui/src/Tests/DisplayOrderTest.php b/core/modules/views_ui/src/Tests/DisplayOrderTest.php
index 54ccd09..053c55b 100644
--- a/core/modules/views_ui/src/Tests/DisplayOrderTest.php
+++ b/core/modules/views_ui/src/Tests/DisplayOrderTest.php
@@ -58,6 +58,7 @@ public function testDisplayOrder() {
     // Add a new block display.
     $this->drupalPostForm(NULL, array(), 'Add Block');
     $this->assertLinkByHref($path_prefix . '/block_1', 0, 'Make sure after adding a display the new display appears in the UI');
+    $this->drupalPostForm(NULL, array(), t('Save'));
 
     // Test that the new view displays are in the correct order.
     $view = Views::getView($view['id']);
diff --git a/core/modules/views_ui/src/ViewFormBase.php b/core/modules/views_ui/src/ViewFormBase.php
index 62897f7..964527b 100644
--- a/core/modules/views_ui/src/ViewFormBase.php
+++ b/core/modules/views_ui/src/ViewFormBase.php
@@ -54,21 +54,7 @@ protected function prepareEntity() {
     if ($tabs = $this->getDisplayTabs($this->entity)) {
       // If a display isn't specified, use the first one.
       if (empty($this->displayID)) {
-
-        uksort($tabs, function($a, $b) {
-          // Prioritize: default, page, block, other ones.
-          if (strpos($a, 'default') === 0 || strpos($b, 'default') === 0) {
-            return -1;
-          }
-          if (strpos($a, 'page') === 0 || strpos($b, 'page') === 0) {
-            return -1;
-          }
-          if (strpos($a, 'block') === 0 || strpos($b, 'block') === 0) {
-            return -1;
-          }
-          return $a < $b ? -1 : 1;
-        });
-
+        $tabs = $this->sortDisplayTabs($tabs);
         foreach ($tabs as $id => $tab) {
           if (!isset($tab['#access']) || $tab['#access']) {
             $this->displayID = $id;
@@ -92,6 +78,36 @@ protected function prepareEntity() {
   }
 
   /**
+   * Sort tabs by name, but prioritize default, page and block.
+   *
+   * @param array $tabs
+   *
+   * @return array
+   */
+  protected function sortDisplayTabs($tabs) {
+    ksort($tabs);
+
+    $default = array_filter(array_keys($tabs), function ($value) {
+      return (strpos($value, 'default') === 0) ? TRUE : FALSE;
+    });
+
+    $page = array_filter(array_keys($tabs), function ($value) {
+      return (strpos($value, 'page') === 0) ? TRUE : FALSE;
+    });
+
+    $block = array_filter(array_keys($tabs), function ($value) {
+      return (strpos($value, 'block') === 0) ? TRUE : FALSE;
+    });
+
+    $sorted = array();
+    $sorted += array_intersect_key($tabs, array_flip($default));
+    $sorted += array_intersect_key($tabs, array_flip($page));
+    $sorted += array_intersect_key($tabs, array_flip($block));
+    $sorted += $tabs;
+    return $sorted;
+  }
+
+  /**
    * Creates an array of Views admin CSS for adding or attaching.
    *
    * This returns an array of arrays. Each array represents a single
