Commit 4d9f2d4db4a for woocommerce
commit 4d9f2d4db4a0f9c2127ce92df316bea4769e7e02
Author: Tung Du <dinhtungdu@gmail.com>
Date: Wed Nov 25 18:34:34 2026 +0700
Hide product gallery thumbnails from screen readers (#71423)
* Hide product gallery thumbnails from screen readers
The thumbnail strip under the single product gallery repeats every
slide image, so screen readers read each image twice. The thumbnails
can't take keyboard focus, so they only help sighted mouse and touch
users. Mark the list aria-hidden once FlexSlider builds it.
Fixes WOOPLUG-612.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f79e-44b3-77f9-8bef-3ef6cc57ac6a
Co-authored-by: Amp <amp@ampcode.com>
* Only hide the thumbnail list FlexSlider builds
Plugins such as Vargal pass their own .flex-control-thumbs list as
manualControls, with links inside. Hiding that list left keyboard focus
on links screen readers could not hear. Hide FlexSlider's own list
instead, which also covers lists moved with controlsContainer.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1f79e-44b3-77f9-8bef-3ef6cc57ac6a
Co-authored-by: Amp <amp@ampcode.com>
---------
Co-authored-by: Amp <amp@ampcode.com>
diff --git a/plugins/woocommerce/changelog/wooplug-612-gallery-thumbnails-screen-readers b/plugins/woocommerce/changelog/wooplug-612-gallery-thumbnails-screen-readers
new file mode 100644
index 00000000000..27ee3c5ceae
--- /dev/null
+++ b/plugins/woocommerce/changelog/wooplug-612-gallery-thumbnails-screen-readers
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Screen readers no longer read each product gallery image twice; the thumbnail strip under the main image is now hidden from them.
diff --git a/plugins/woocommerce/client/legacy/js/frontend/single-product.js b/plugins/woocommerce/client/legacy/js/frontend/single-product.js
index ed11ac5c8ae..166aa3f6efc 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/single-product.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/single-product.js
@@ -288,6 +288,12 @@ jQuery( function( $ ) {
}, args );
$target.flexslider( options );
+ // Thumbnails that FlexSlider builds repeat the slides and can't take keyboard focus, so screen readers skip them.
+ // Lists that other code passes in as manualControls may hold links, so they are left alone.
+ const slider = $target.data( 'flexslider' );
+ if ( slider && slider.controlNavScaffold && 'thumbnails' === slider.vars.controlNav ) {
+ slider.controlNavScaffold.attr( 'aria-hidden', 'true' );
+ }
gallery.initVideoThumbnailPreviews();
$target
.off( 'click.wcProductGalleryVideoThumbs', '.flex-control-thumbs img' )