Improve product thumbnails list markup accessibility#1046
Conversation
tblivet
left a comment
There was a problem hiding this comment.
Thanks @Codencode for this PR 👍
The <li> wrapper and type="button" are good improvements. Two things need fixing before merge, both caused by the buttons no longer being direct children of the <ul>:
→ Active-thumbnail highlight (blue outline) breaks on navigation. activeThumbail in selectors-map.ts uses .js-thumb-container:nth-child(n), which assumed the button was a direct child of the <ul>. Now each button is :nth-child(1) of its <li>, so the outline disappears when you click/slide past the first image.
→ Thumbnail no longer fills its grid cell. The <li> is now the grid item, so the button reverts to inline-block. I think we could force &__thumbnail in _product.scss to take 100% of the available width (in case a merchant sets smaller thumbnail dimensions and regenerates them).
|
This pull request seems to contain new translation strings. I have summarized them below to ease up review:
(Note: this is an automated message, but answering it will reach a real human) |
|
@tblivet I made the 2 changes, I hope I understood what you meant. Can you check? |
|
Sorry @Codencode, few more things 🙏 The goal is to migrate step by step to this convention, so I don't think we should add selectors like You can keep the classes for styling and just add the refs, e.g. activeThumbail: (id: number): string => `[data-ps-ref="product-thumbnail-item"]:nth-child(${id + 1}) [data-ps-ref="product-thumbnail"]`,Also, about the Thanks 🙌 |
|
@tblivet no worries, no problem at all. |
tblivet
left a comment
There was a problem hiding this comment.
Thank you @Codencode that's all good 👍
ingridusta
left a comment
There was a problem hiding this comment.
Hi @Codencode,
Works as expected, and no regressions with keyboard nav :
Enregistrement.de.l.ecran.2026-06-18.a.16.05.04.mov
It's QA Approved ✅
<li>element.This makes the HTML structure more semantic and accessible, since the direct children of a
<ul>should be list items.It also adds
type="button"to the thumbnail buttons to prevent unwanted submit behavior in form contexts.2. Check that the product thumbnails are displayed correctly.
3. Click each thumbnail and verify that the main product image changes as expected.
4. Inspect the generated HTML and verify that:
-
.product__thumbnails-listis a<ul>;- each direct child of the
<ul>is a<li class="product__thumbnails-item">;- each thumbnail button has
type="button";- the active thumbnail still has the
activeclass andaria-current="true".5. Verify that there are no visual regressions on desktop and mobile.