diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 38c01e5cc7b7cf32f748b1653824c6fdc6f8e24b..f5c1d3905f6e08a9ba256fbdc8638bce468d7b63 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1462,7 +1462,8 @@ function template_preprocess_field_multiple_value_form(&$variables): void {
 
   if ($variables['multiple']) {
     $table_id = Html::getUniqueId($element['#field_name'] . '_values');
-    $order_class = $element['#field_name'] . '-delta-order';
+    // Using table id allows handing nested content with the same field names.
+    $order_class = $table_id . '-delta-order';
     $header_attributes = new Attribute(['class' => ['label']]);
     if (!empty($element['#required'])) {
       $header_attributes['class'][] = 'js-form-required';