From f4afdcdd249b5aa4797e52f0c6589beb2fe42267 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 23 Jun 2026 11:29:19 -0300 Subject: [PATCH 1/3] Try to enable submit button on safari autofill --- paypal/js/frontend.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/paypal/js/frontend.js b/paypal/js/frontend.js index 13371c0a8a..fd59a2c3b2 100644 --- a/paypal/js/frontend.js +++ b/paypal/js/frontend.js @@ -718,7 +718,12 @@ onError, style: frmPayPalVars.style, inputEvents: { - onChange: onCardFieldsChange + onChange: onCardFieldsChange, + onFocus: function() { + // onBlur only triggers if onFocus is defined. + // But we don't need to do anything on focus. + }, + onBlur: onCardFieldsBlur } }; @@ -749,6 +754,20 @@ } } + /** + * Handle card field blur events. + * This detects autofilled fields that may not trigger onChange. + * + * @param {Object} data The onBlur event data. + */ + function onCardFieldsBlur( data ) { + alert( 'blur' ); + if ( selectedMethod === 'card' && data.isFormValid ) { + cardFieldsValid = true; + enableSubmit(); + } + } + /** * Render the card number / expiry / CVV fields into the method container. */ From 60d00cdf2bbaf9eb5adc5580b0be1f7bb506c669 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 23 Jun 2026 11:29:48 -0300 Subject: [PATCH 2/3] Remove the alert --- paypal/js/frontend.js | 1 - 1 file changed, 1 deletion(-) diff --git a/paypal/js/frontend.js b/paypal/js/frontend.js index fd59a2c3b2..96a0111d96 100644 --- a/paypal/js/frontend.js +++ b/paypal/js/frontend.js @@ -761,7 +761,6 @@ * @param {Object} data The onBlur event data. */ function onCardFieldsBlur( data ) { - alert( 'blur' ); if ( selectedMethod === 'card' && data.isFormValid ) { cardFieldsValid = true; enableSubmit(); From 70edd5ae58d6917f13771eef3693d917bdf3e30d Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 23 Jun 2026 11:45:20 -0300 Subject: [PATCH 3/3] Use object shorthand --- paypal/js/frontend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paypal/js/frontend.js b/paypal/js/frontend.js index 96a0111d96..e9bd5bcd33 100644 --- a/paypal/js/frontend.js +++ b/paypal/js/frontend.js @@ -719,7 +719,7 @@ style: frmPayPalVars.style, inputEvents: { onChange: onCardFieldsChange, - onFocus: function() { + onFocus() { // onBlur only triggers if onFocus is defined. // But we don't need to do anything on focus. },