Ignore container header for form field dependencies
authorMatthias Schmidt <gravatronics@live.com>
Mon, 12 Mar 2018 06:15:38 +0000 (07:15 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 12 Mar 2018 06:15:38 +0000 (07:15 +0100)
See #2509

wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Dependency/Container/Default.js

index 67b4129db684744e37e0ab73f700ccb24d6f37ba..de048231965f0bc29aeda9f5664ab2f18a9a5f51 100644 (file)
@@ -32,7 +32,13 @@ define(['./Abstract', 'Core', '../Manager'], function(Abstract, Core, Dependency
                        var containerShouldBeVisible = false;
                        
                        var children = this._container.children;
-                       for (var i = 0, length = children.length; i < length; i++) {
+                       var start = 0;
+                       // ignore container header for visibility considerations
+                       if (this._container.children.item(0).tagName === 'H2' || this._container.children.item(0).tagName === 'HEADER') {
+                               var start = 1;
+                       }
+                       
+                       for (var i = start, length = children.length; i < length; i++) {
                                if (!elIsHidden(children.item(i))) {
                                        containerShouldBeVisible = true;
                                }