Fix #1912 -- Auto-open all <details> with an error inside

This commit is contained in:
Raphael Michel
2021-02-15 18:30:06 +01:00
parent 9fdaf040dc
commit 488273d5f2

View File

@@ -41,7 +41,12 @@ setup_collapsible_details = function (el) {
$detailsNotSummary = $details.children(':not(summary)');
$details.prop('open', typeof $details.attr('open') == 'string');
if (!$details.prop('open')) {
$detailsNotSummary.hide();
if ($details.find(".has-error, .alert-danger").length) {
$details.addClass("details-open");
$details.prop('open', true);
} else {
$detailsNotSummary.hide();
}
} else {
$details.addClass("details-open");
}