Skip to content

Commit

Permalink
fix: account for refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenn00dle committed Dec 16, 2024
1 parent 08eb503 commit c66d116
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/other-scripts/recaptcha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,22 @@ function render( forms = [], onSuccess = null, onError = null ) {
formsToHandle.forEach( form => {
if ( ! form.hasAttribute( 'data-recaptcha-rendered' ) ) {
form.addEventListener( 'focusin', () => {
if ( isV3 ) {
addHiddenV3Field( form );
}
if ( isV2 ) {
renderV2Widget( form, onSuccess, onError );
}
if ( isV3 ) {
addHiddenV3Field( form );
}
} );
form.setAttribute( 'data-recaptcha-rendered', 'true' );
} else {
// Call render methods to trigger refresh.
if ( isV2 ) {
renderV2Widget( form, onSuccess, onError );
}
if ( isV3 ) {
addHiddenV3Field( form );
}
}
} );
}
Expand Down

0 comments on commit c66d116

Please sign in to comment.