diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php
index 9e7e391..7c826ae 100644
--- a/core/modules/taxonomy/src/Form/OverviewTerms.php
+++ b/core/modules/taxonomy/src/Form/OverviewTerms.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\taxonomy\Form;
 
+use Drupal\Component\Utility\SortArray;
 use Drupal\Core\Entity\EntityManagerInterface;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Extension\ModuleHandlerInterface;
@@ -380,8 +381,25 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
    *   The current state of the form.
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    // Sort term order based on weight.
-    uasort($form_state->getValue('terms'), array('Drupal\Component\Utility\SortArray', 'sortByWeightElement'));
+    // Mark each term with the current order in which they are displayed in the
+    // form.
+    $current_order = 0;
+    $values = $form_state->getValues();
+    foreach ($values as $tid => &$value) {
+      if (isset($form[$tid]['#term'])) {
+        $value->setValue('current_order', $current_order++);
+      }
+    }
+
+    // Sort terms, first on weight, second on the current order.
+    uasort($values, function ($a, $b) {
+      // If the terms have different weights, sort by weight.
+      if ($result = SortArray::sortByWeightElement((array) $a, (array) $b)) {
+        return $result;
+      }
+      // If the weights are identical, sort by the current order.
+      return SortArray::sortByKeyInt($a, $b, 'current_order');
+    });
 
     $vocabulary = $form_state->get(['taxonomy', 'vocabulary']);
     // Update the current hierarchy type as we go.
