From b7fd29aecfa81f08d1a3ed61219647762d3a70f7 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 24 Jun 2026 11:38:04 -0300 Subject: [PATCH 1/7] Fix submit button when autofilling PayPal card fields --- paypal/js/frontend.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/paypal/js/frontend.js b/paypal/js/frontend.js index 13371c0a8a..f048e422cd 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() { + // This is intentionally left blank, but it should not be deleted. + // onFocus is required for onBlur to work. + }, + onBlur: onCardFieldsBlur } }; @@ -749,6 +754,28 @@ } } + /** + * Handle card field blur events. + * + * @param {Object} data The onBlur event data. + */ + async function onCardFieldsBlur( data ) { + try { + const state = await cardFieldsInstance.getState(); + cardFieldsValid = state.isFormValid; + + if ( selectedMethod === 'card' ) { + if ( cardFieldsValid ) { + enableSubmit(); + } else { + disableSubmit( thisForm ); + } + } + } catch ( err ) { + console.error( 'Failed to get card field state on blur', err ); + } + } + /** * Render the card number / expiry / CVV fields into the method container. */ From 267e6c925f6c2547e8a541fd8464cf521db11830 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 24 Jun 2026 11:39:47 -0300 Subject: [PATCH 2/7] Remove console.error --- paypal/js/frontend.js | 1 - 1 file changed, 1 deletion(-) diff --git a/paypal/js/frontend.js b/paypal/js/frontend.js index f048e422cd..2757d10439 100644 --- a/paypal/js/frontend.js +++ b/paypal/js/frontend.js @@ -772,7 +772,6 @@ } } } catch ( err ) { - console.error( 'Failed to get card field state on blur', err ); } } From cfe3c9b2ed57e091e2b154744164fc878c73007b Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 24 Jun 2026 11:41:32 -0300 Subject: [PATCH 3/7] 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 2757d10439..b46fc4892c 100644 --- a/paypal/js/frontend.js +++ b/paypal/js/frontend.js @@ -719,7 +719,7 @@ style: frmPayPalVars.style, inputEvents: { onChange: onCardFieldsChange, - onFocus: function() { + onFocus() { // This is intentionally left blank, but it should not be deleted. // onFocus is required for onBlur to work. }, From 8c706e0571fed4a6a098d0739f7c00bbacd1d8ba Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 24 Jun 2026 11:46:01 -0300 Subject: [PATCH 4/7] Drop the param --- paypal/js/frontend.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/paypal/js/frontend.js b/paypal/js/frontend.js index b46fc4892c..d1cc945451 100644 --- a/paypal/js/frontend.js +++ b/paypal/js/frontend.js @@ -756,10 +756,8 @@ /** * Handle card field blur events. - * - * @param {Object} data The onBlur event data. */ - async function onCardFieldsBlur( data ) { + async function onCardFieldsBlur() { try { const state = await cardFieldsInstance.getState(); cardFieldsValid = state.isFormValid; From ce0325081cae6ca501e453ed08acd4ce21c2498b Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 24 Jun 2026 12:02:39 -0300 Subject: [PATCH 5/7] Try to ignore eslint errors --- paypal/js/frontend.js | 1 + 1 file changed, 1 insertion(+) diff --git a/paypal/js/frontend.js b/paypal/js/frontend.js index d1cc945451..e9d4f01713 100644 --- a/paypal/js/frontend.js +++ b/paypal/js/frontend.js @@ -719,6 +719,7 @@ style: frmPayPalVars.style, inputEvents: { onChange: onCardFieldsChange, + // eslint-disable-next-line no-empty, unicorn/no-empty-brace-spaces onFocus() { // This is intentionally left blank, but it should not be deleted. // onFocus is required for onBlur to work. From 8a4c9d2ccf53fd71b7af987db3a5bf8216fc571d Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 24 Jun 2026 12:10:54 -0300 Subject: [PATCH 6/7] Fix linting issues --- .github/workflows/oxlint.yml | 3 --- paypal/js/frontend.js | 11 ++++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/oxlint.yml b/.github/workflows/oxlint.yml index ff28416e57..5a42efa0ae 100644 --- a/.github/workflows/oxlint.yml +++ b/.github/workflows/oxlint.yml @@ -24,8 +24,5 @@ jobs: with: node-version: "22" - - name: Install Oxlint - run: npm install oxlint@1.59.0 --no-package-lock - - name: Run Oxlint run: ./node_modules/.bin/oxlint . --format unix diff --git a/paypal/js/frontend.js b/paypal/js/frontend.js index e9d4f01713..a10bb5a862 100644 --- a/paypal/js/frontend.js +++ b/paypal/js/frontend.js @@ -719,11 +719,9 @@ style: frmPayPalVars.style, inputEvents: { onChange: onCardFieldsChange, - // eslint-disable-next-line no-empty, unicorn/no-empty-brace-spaces - onFocus() { - // This is intentionally left blank, but it should not be deleted. - // onFocus is required for onBlur to work. - }, + // This is intentionally left blank, but it should not be deleted. onFocus is required for onBlur to work. + // eslint-disable-next-line no-empty + onFocus() {}, onBlur: onCardFieldsBlur } }; @@ -770,8 +768,7 @@ disableSubmit( thisForm ); } } - } catch ( err ) { - } + } catch ( err ) {} // eslint-disable-line no-empty } /** From 9e3e9b56c160efe59758f3f1c8f51b6be7b86a71 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 24 Jun 2026 12:11:57 -0300 Subject: [PATCH 7/7] Revert workflow change --- .github/workflows/oxlint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/oxlint.yml b/.github/workflows/oxlint.yml index 5a42efa0ae..ff28416e57 100644 --- a/.github/workflows/oxlint.yml +++ b/.github/workflows/oxlint.yml @@ -24,5 +24,8 @@ jobs: with: node-version: "22" + - name: Install Oxlint + run: npm install oxlint@1.59.0 --no-package-lock + - name: Run Oxlint run: ./node_modules/.bin/oxlint . --format unix