Commit 152f23e1f5d for woocommerce

commit 152f23e1f5db72f16b014e818cfea1a66668144c
Author: Francesco <frosso@users.noreply.github.com>
Date:   Fri Aug 7 16:35:38 2026 +0200

    fix: a11y on the classic shipping calculator link (#67137)

diff --git a/plugins/woocommerce/changelog/fix-51896-shipping-calculator-button b/plugins/woocommerce/changelog/fix-51896-shipping-calculator-button
new file mode 100644
index 00000000000..0096b45d2b8
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-51896-shipping-calculator-button
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Improve keyboard and screen reader accessibility for button-like links in the classic cart.
diff --git a/plugins/woocommerce/client/legacy/css/woocommerce.scss b/plugins/woocommerce/client/legacy/css/woocommerce.scss
index 53865a39fec..4c71109e152 100644
--- a/plugins/woocommerce/client/legacy/css/woocommerce.scss
+++ b/plugins/woocommerce/client/legacy/css/woocommerce.scss
@@ -2004,6 +2004,7 @@ p.demo_store,

 		.shipping-calculator-button::after {
 			@include iconafter("\e019");
+			content: "\e019" / "";
 		}

 		.shipping-calculator-form {
diff --git a/plugins/woocommerce/client/legacy/js/frontend/cart.js b/plugins/woocommerce/client/legacy/js/frontend/cart.js
index ef7e927612e..8f9a7fbd028 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/cart.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/cart.js
@@ -233,6 +233,21 @@ jQuery( function ( $ ) {
 		$target.append( $coupon_error_el );
 	};

+	/**
+	 * Handle when pressing the Space key on a link with the button role.
+	 *
+	 * @param {Object} event The jQuery event.
+	 */
+	var on_keydown_button = function ( event ) {
+		if ( event.key === ' ' ) {
+			event.preventDefault();
+
+			if ( ! event.originalEvent || ! event.originalEvent.repeat ) {
+				$( event.currentTarget ).trigger( 'click' );
+			}
+		}
+	};
+
 	/**
 	 * Object to handle AJAX calls for cart shipping changes.
 	 */
@@ -253,6 +268,11 @@ jQuery( function ( $ ) {
 				'.shipping-calculator-button',
 				this.toggle_shipping
 			);
+			$( document ).on(
+				'keydown',
+				'.shipping-calculator-button',
+				on_keydown_button
+			);
 			$( document ).on(
 				'change',
 				'select.shipping_method, :input[name^=shipping_method]',
@@ -296,7 +316,6 @@ jQuery( function ( $ ) {
 		shipping_method_selected: function ( event ) {
 			var shipping_methods = {};

-			// eslint-disable-next-line max-len
 			$(
 				'select.shipping_method, :input[name^=shipping_method][type=radio]:checked, :input[name^=shipping_method][type=hidden]'
 			).each( function () {
@@ -415,7 +434,7 @@ jQuery( function ( $ ) {
 			$( document ).on(
 				'keydown',
 				'a.woocommerce-remove-coupon',
-				this.on_keydown_remove_coupon
+				on_keydown_button
 			);
 			$( document ).on(
 				'click',
@@ -425,7 +444,7 @@ jQuery( function ( $ ) {
 			$( document ).on(
 				'keydown',
 				'.woocommerce-cart-form .product-remove > a',
-				this.on_keydown_remove_item
+				on_keydown_button
 			);
 			$( document ).on(
 				'click',
@@ -682,20 +701,6 @@ jQuery( function ( $ ) {
 			} );
 		},

-		/**
-		 * Handle when pressing the Space key on the remove coupon link.
-		 * This is necessary because the link got the role="button" attribute
-		 * and needs to act like a button.
-		 *
-		 * @param {Object} evt The JQuery event
-		 */
-		on_keydown_remove_coupon: function ( evt ) {
-			if ( evt.key === ' ' ) {
-				evt.preventDefault();
-				$( evt.currentTarget ).trigger( 'click' );
-			}
-		},
-
 		/**
 		 * Handle when the coupon input loses focus.
 		 *
@@ -774,20 +779,6 @@ jQuery( function ( $ ) {
 			} );
 		},

-		/**
-		 * Handle when pressing the Space key on the remove item link.
-		 * This is necessary because the link got the role="button" attribute
-		 * and needs to act like a button.
-		 *
-		 * @param {Object} evt The JQuery event
-		 */
-		on_keydown_remove_item: function ( event ) {
-			if ( event.key === ' ' ) {
-				event.preventDefault();
-				$( event.currentTarget ).trigger( 'click' );
-			}
-		},
-
 		/**
 		 * Handle when a restore item link is clicked.
 		 *