From: Matthias Schmidt Date: Tue, 18 May 2021 04:56:48 +0000 (+0200) Subject: Properly position errors below fields in `.inputAddon` elements (#4219) X-Git-Tag: 5.4.0_Alpha_3~5^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c1caac2dd8188851bd46524fe28c01bed6d83430;p=GitHub%2FWoltLab%2FWCF.git Properly position errors below fields in `.inputAddon` elements (#4219) --- diff --git a/wcfsetup/install/files/js/wcf.globalHelper.js b/wcfsetup/install/files/js/wcf.globalHelper.js index c4c7009a98..472001ccc7 100644 --- a/wcfsetup/install/files/js/wcf.globalHelper.js +++ b/wcfsetup/install/files/js/wcf.globalHelper.js @@ -207,7 +207,14 @@ } } - 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; @@ -215,7 +222,7 @@ else { innerError = elCreate('small'); innerError.className = 'innerError'; - parent.insertBefore(innerError, element.nextSibling); + insertTarget.insertBefore(innerError, referenceElement.nextSibling); } }