From c1caac2dd8188851bd46524fe28c01bed6d83430 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 18 May 2021 06:56:48 +0200 Subject: [PATCH] Properly position errors below fields in `.inputAddon` elements (#4219) --- wcfsetup/install/files/js/wcf.globalHelper.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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); } } -- 2.20.1