From 4ec967525117f0775b9cef259f7905fda4dd7957 Mon Sep 17 00:00:00 2001 From: Rasmy Nguyen Date: Fri, 13 Dec 2024 13:03:26 -0500 Subject: [PATCH] fix: adjust styles --- src/other-scripts/recaptcha/index.js | 14 ++++++++------ src/other-scripts/recaptcha/style.scss | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/other-scripts/recaptcha/index.js b/src/other-scripts/recaptcha/index.js index add2951124..bbf22871cf 100644 --- a/src/other-scripts/recaptcha/index.js +++ b/src/other-scripts/recaptcha/index.js @@ -90,13 +90,15 @@ function addErrorMessage( form, message ) { const errorText = document.createElement( 'p' ); errorText.textContent = message; const container = document.createElement( 'div' ); - container.classList.add( - 'newspack-ui__notice', - 'newspack-ui__notice--error', - 'newspack-recaptcha-error' - ); + container.classList.add( 'newspack-recaptcha-error' ); container.appendChild( errorText ); - form.insertBefore( container, form.firstChild ); + // Newsletters block errors render below the form. + if ( form.parentElement.classList.contains( 'newspack-newsletters-subscribe' ) ) { + form.append( container ); + } else { + container.classList.add( 'newspack-ui__notice', 'newspack-ui__notice--error' ); + form.insertBefore( container, form.firstChild ); + } } /** diff --git a/src/other-scripts/recaptcha/style.scss b/src/other-scripts/recaptcha/style.scss index 9ea82aa4cc..b6bfb43f17 100644 --- a/src/other-scripts/recaptcha/style.scss +++ b/src/other-scripts/recaptcha/style.scss @@ -15,5 +15,7 @@ } .newspack-recaptcha-error { - margin-top: 0 !important; + &.newspack-ui__notice--error { + margin-top: 0 !important; + } }