Commit 0bcd52a49a8 for woocommerce

commit 0bcd52a49a82cdf814a02191b86904fc9fa04201
Author: Faisal Ahammad <faisalahammad24@gmail.com>
Date:   Thu Jul 23 22:50:23 2026 +0600

    fix: replace deprecated jQuery focus() shorthand across legacy JS files (#66273)

diff --git a/plugins/woocommerce/changelog/60501-fix-jquery-focus-deprecated-checkout b/plugins/woocommerce/changelog/60501-fix-jquery-focus-deprecated-checkout
new file mode 100644
index 00000000000..2ee477160f8
--- /dev/null
+++ b/plugins/woocommerce/changelog/60501-fix-jquery-focus-deprecated-checkout
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Replace deprecated jQuery .focus() shorthand with .trigger( 'focus' ) / .on( 'focus' ) across legacy JS files.
diff --git a/plugins/woocommerce/client/legacy/js/admin/wc-shipping-zone-methods.js b/plugins/woocommerce/client/legacy/js/admin/wc-shipping-zone-methods.js
index a7bfabadc92..5bf7c0479e9 100644
--- a/plugins/woocommerce/client/legacy/js/admin/wc-shipping-zone-methods.js
+++ b/plugins/woocommerce/client/legacy/js/admin/wc-shipping-zone-methods.js
@@ -437,7 +437,7 @@
 				},
 				highlightOnFocus: function( query ) {
 					const inputs = $( query );
-					inputs.focus( function() {
+					inputs.on( 'focus', function() {
 						$( this ).select();
 					} );
 				},
diff --git a/plugins/woocommerce/client/legacy/js/frontend/account-i18n.js b/plugins/woocommerce/client/legacy/js/frontend/account-i18n.js
index 6ceba641435..8e046bc7a96 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/account-i18n.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/account-i18n.js
@@ -14,7 +14,7 @@ jQuery( function( $ ) {
          * in between.
          */
         setTimeout(function() {
-            $(notices[0]).attr('tabindex', '-1').focus();
+            $(notices[0]).attr('tabindex', '-1').trigger( 'focus' );
         });
     }
 });
diff --git a/plugins/woocommerce/client/legacy/js/frontend/cart.js b/plugins/woocommerce/client/legacy/js/frontend/cart.js
index 1c01c893b8b..ef7e927612e 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/cart.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/cart.js
@@ -155,7 +155,7 @@ jQuery( function ( $ ) {
 				$new_coupon_field.val( $old_coupon_field_val );
 				// The coupon input with error needs to be focused before adding the live region
 				// with the error message, otherwise the screen reader won't read it.
-				$new_coupon_field.focus();
+				$new_coupon_field.trigger( 'focus' );
 				show_coupon_error( $old_coupon_error_msg, $new_coupon_field_wrapper, true );
 			}

diff --git a/plugins/woocommerce/client/legacy/js/frontend/checkout.js b/plugins/woocommerce/client/legacy/js/frontend/checkout.js
index 622f9192afc..052c7033acb 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/checkout.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/checkout.js
@@ -1087,7 +1087,7 @@ jQuery( function ( $ ) {
 				.find(
 					'.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]'
 				)
-				.focus();
+				.trigger( 'focus' );
 			$( document.body ).trigger( 'checkout_error', [ error_message ] );
 		},
 		wrapMessagesInsideLink: function ( $msgs ) {
@@ -1198,7 +1198,7 @@ jQuery( function ( $ ) {

 			$target
 				.find( '#coupon_code' )
-				.focus()
+				.trigger( 'focus' )
 				.addClass( 'has-error' )
 				.attr( 'aria-invalid', 'true' )
 				.attr( 'aria-describedby', 'coupon-error-notice' );
diff --git a/plugins/woocommerce/client/legacy/js/frontend/single-product.js b/plugins/woocommerce/client/legacy/js/frontend/single-product.js
index 16b2027a215..ed11ac5c8ae 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/single-product.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/single-product.js
@@ -107,7 +107,7 @@ jQuery( function( $ ) {
 				targetIndex = 0;
 			}

-			$tabs.eq( targetIndex ).focus();
+			$tabs.eq( targetIndex ).trigger( 'focus' );
 		} )
 		// Review link
 		.on( 'click', 'a.woocommerce-review-link', function() {
@@ -187,12 +187,12 @@ jQuery( function( $ ) {
 			e.stopPropagation();

 			if ( next.includes( direction ) ) {
-				$( this ).next().focus().click();
+				$( this ).next().trigger( 'focus' ).click();

 				return;
 			}

-			$( this ).prev().focus().click();
+			$( this ).prev().trigger( 'focus' ).click();
 		} );

 	// Init Tabs and Star Ratings
diff --git a/plugins/woocommerce/client/legacy/js/frontend/woocommerce.js b/plugins/woocommerce/client/legacy/js/frontend/woocommerce.js
index 1ee26bc2efc..362f5e7e03e 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/woocommerce.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/woocommerce.js
@@ -157,7 +157,7 @@ jQuery( function ( $ ) {
 				.prop( 'type', 'password' );
 		}

-		$( this ).siblings( 'input' ).focus();
+		$( this ).siblings( 'input' ).trigger( 'focus' );
 	} );

 	$( 'a.coming-soon-footer-banner-dismiss' ).on( 'click', function ( e ) {