X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ddb7f33868ea499ab8f48a7062f145e8c0fbe02f..d44acf4b:/resources/js/components/collapsible.js diff --git a/resources/js/components/collapsible.js b/resources/js/components/collapsible.js index 464f394c1..a630f38f2 100644 --- a/resources/js/components/collapsible.js +++ b/resources/js/components/collapsible.js @@ -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; \ No newline at end of file