Auto-expand collapsible sections if containing error

For #1693
This commit is contained in:
Dan Brown 2019-12-16 13:27:17 +00:00
parent a9634b6b66
commit b93f8a4d46
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -12,8 +12,8 @@ class Collapsible {
this.content = elem.querySelector('[collapsible-content]');
if (!this.trigger) return;
this.trigger.addEventListener('click', this.toggle.bind(this));
this.openIfContainsError();
}
open() {
@ -36,6 +36,13 @@ class Collapsible {
}
}
openIfContainsError() {
const error = this.content.querySelector('.text-neg');
if (error) {
this.open();
}
}
}
export default Collapsible;