Fieldset elements do not respect the #description_display option
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3277799. --> Reported by: [ambient.impact](https://www.drupal.org/user/1131532) Related to !143 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I was wondering why <code>#description_display</code> with a value of <code>before</code> wasn't working on fieldsets, until a search turned up the fact that support for this in the core templates was only added in 9.3.0. See <a href="https://www.drupal.org/node/3143489">the change record</a>.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <div class="codeblock"> <pre><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $form</span><span style="color: #007700">[</span><span style="color: #DD0000">'fieldset'</span><span style="color: #007700">] = [<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#type'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'fieldset'</span><span style="color: #007700">,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#title'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'...'</span><span style="color: #007700">),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#description'&nbsp; </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">t</span><span style="color: #007700">(</span><span style="color: #DD0000">'...'</span><span style="color: #007700">),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #DD0000">'#description_display' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'before'</span><span style="color: #007700">,<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ];<br></span><span style="color: #0000BB">?&gt;</span></span></pre></div> <p>Fieldset description is placed after despite this.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Looks like both the template and some of the CSS needs to be updated to support this. A quick and dirty edit to Gin's <code>fieldset.html.twig</code> seems to work for the output, but it breaks the layout of the fieldset:</p> <p><img src="https://www.drupal.org/files/issues/2022-04-28/gin-3277799-fieldset-description_display.png" width="601" height="581" alt="Fieldsets with the descriptions before their content, with the fieldset layout broken."></p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>Update the template and related CSS.</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>???</p> <h3 id="summary-api-changes">API changes</h3> <p>???</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>???</p>
issue