Properly position errors below fields in `.inputAddon` elements (#4219)
authorMatthias Schmidt <gravatronics@live.com>
Tue, 18 May 2021 04:56:48 +0000 (06:56 +0200)
committerGitHub <noreply@github.com>
Tue, 18 May 2021 04:56:48 +0000 (06:56 +0200)
wcfsetup/install/files/js/wcf.globalHelper.js

index c4c7009a98baaaf0922178633a1fb3d5b7f9b42e..472001ccc7f6dcf8823408bc9389ddae6478ba86 100644 (file)
                        }
                }
                
-               var innerError = element.nextElementSibling;
+               var insertTarget = parent;
+               var referenceElement = element;
+               if (insertTarget.classList.contains('inputAddon')) {
+                       insertTarget = parent.parentElement;
+                       referenceElement = parent;
+               }
+               
+               var innerError = referenceElement.nextElementSibling;
                if (innerError === null || innerError.nodeName !== 'SMALL' || !innerError.classList.contains('innerError')) {
                        if (errorMessage === '') {
                                innerError = null;
                        else {
                                innerError = elCreate('small');
                                innerError.className = 'innerError';
-                               parent.insertBefore(innerError, element.nextSibling);
+                               insertTarget.insertBefore(innerError, referenceElement.nextSibling);
                        }
                }