diff --git a/core/lib/Drupal/Core/Render/Element/Details.php b/core/lib/Drupal/Core/Render/Element/Details.php index e6f4474..a336730 100644 --- a/core/lib/Drupal/Core/Render/Element/Details.php +++ b/core/lib/Drupal/Core/Render/Element/Details.php @@ -87,6 +87,7 @@ public static function preRenderDetails($element) { // Loop through widgets looking for errors, make sure to enable #open if any are found. if (!empty($element['#parents'])) { $parents = implode('][', $element['#parents']); + if (!empty($element['#groups'][$parents])) { $children = Element::children($element['#groups'][$parents]); if (!empty($children)) { foreach ($children as $key) { @@ -101,6 +102,7 @@ public static function preRenderDetails($element) { } } } + } // Do not render optional details elements if there are no children. if (isset($element['#parents'])) {