Closed dashouse closed 6 years ago
Possibly related - consider printing warnings where required arguments aren't provided (though it sounds like that isn't the case here).
oh i see.
yes, if neither titleHtml
or titleText
it will just be an empty h2
don't know whether we should enable adding just a class on h2, but we could do something like
{% if params.titleText %}
<h2 class="govuk-c-panel__title">
{{ params.titleText }}
</h2>
{% elif params.titleHtml %}
{{ params.titleHtml | safe }} //make your own heading and content
{% endif %}
Title
titleText
adds content inside anh2
with the class ofgovuk-c-panel__title
titleHtml
also adds content inside theh2
, meaning you cannot actually add HTML or add a class to thish2
. If you try you end up with an emptyh2
above or around your new HTML.Empty div
The
text
argument is not conditional, therefore if a user wants to add only a title to their panel (it happens) they will end up with an empty divgovuk-c-panel__body
.Current code
Suggested change (along the lines of)
I wonder if there is a broader review of components to check for other situations where empty divs are created when a user removes a component argument?