Rubik Combined Listings Swatch is built with accessibility as a core consideration. Every swatch type — visual, button, and dropdown — includes features that help customers using screen readers, keyboards, and other assistive technologies navigate and select product options.
The component uses meaningful HTML elements rather than generic <div> containers:
<a href> element pointing to the linked product's URL. This means swatches are
natively focusable, clickable, and navigable without any extra JavaScript.
<select> element, which is fully supported by all screen readers and provides
built-in keyboard interaction.
aria-hidden="true", so screen readers
skip them and focus on the meaningful text content instead.
Every interactive element includes an aria-label attribute so screen readers can
announce what each control does:
| Element | ARIA attribute | Example value |
|---|---|---|
| Visual swatch | aria-label |
"Blue" (option value, falling back to the product title) |
| Button swatch | aria-label |
"Red" (option value, falling back to the product title) |
| Dropdown | aria-label |
"Color" (the option name) |
| Overflow indicator (+n) | aria-label |
"Show 5 more options" (number of hidden swatches) |
Labels prefer the option value over the product title because linked products often share one title: without this, every swatch in a group would announce identically and screen reader users could not tell the options apart.
The currently selected swatch is announced to screen readers using aria-current="true".
When a customer clicks a different swatch, the previous one loses the attribute and the new selection
receives it. This lets assistive technology users know which option is currently active without
relying on visual cues alone.
Swatch groups use ARIA group roles and label associations to provide context:
role="group"
id, and the group container
references it via aria-labelledby
All swatch types are fully operable with a keyboard:
<a> elements,
they are in the natural tab order. Customers can Tab through swatches and press
Enter to navigate to the linked product.
<select> element supports
Arrow Up/Arrow Down to browse options and Enter to select.
tabindex="0" and
role="button", making it focusable and operable with both Enter and
Space keys. It exposes its state via aria-expanded, and activating it
moves focus to the first newly revealed swatch, so keyboard and screen reader users keep
their place instead of being returned to the top of the page.
The component handles focus states carefully to balance visual clarity with usability:
:focus-visible) but are hidden for mouse clicks (:focus:not(:focus-visible)).
This prevents distracting outlines during normal browsing while keeping them visible for keyboard users.
:focus-visible
still show focus outlines via the standard :focus pseudo-class.
Unavailable products are communicated through multiple channels, not just color or opacity:
aria-hidden="true" since it is decorative.
Beyond these visual cues, availability is also announced programmatically for visual and button swatches: the accessible name of an unavailable swatch appends "sold out" (for example "Mauve, sold out"), so screen reader users hear the same information the crossed-out styling conveys visually. Dropdown options list the option value only.
The component adapts its behavior for touch devices:
(hover: none) media query and disables hover tooltips, which would otherwise be
inaccessible on touchscreens.
The component does not rely on color alone to convey information:
The component includes fallbacks to ensure accessibility features work across a wide range of browsers:
| Feature | Fallback |
|---|---|
:focus-visible |
Standard :focus outline on older browsers |
aspect-ratio |
Padding-bottom technique for Safari 14 and earlier |
Flexbox gap |
Negative margin technique for older iOS Safari |
backdrop-filter |
Solid background color on unsupported browsers |
| Attribute | Where used | Purpose |
|---|---|---|
aria-label |
All swatches, dropdowns, overflow indicator | Announces the element's purpose to screen readers |
aria-current="true" |
Active/selected swatch | Indicates which option is currently selected |
aria-expanded |
Overflow indicator (+n) | Communicates whether the hidden swatches have been revealed |
aria-hidden="true" |
Color SVGs, out-of-stock lines, placeholders | Hides decorative elements from screen readers |
aria-labelledby |
Swatch grids and carousels | Associates the group with its visible label |
role="group" |
Swatch grids and carousels | Groups related swatches semantically |
role="button" |
Overflow indicator (+n) | Identifies a clickable non-link element as a button |
tabindex="0" |
Overflow indicator (+n) | Makes the element focusable via keyboard |
Rubik Combined Listings Swatch provides accessible product navigation out of the box. Screen reader users hear descriptive labels and group context. Keyboard users can tab through and activate swatches. Touch users get appropriately adapted interactions. And all users benefit from multiple visual cues for selected and out-of-stock states that do not rely on color alone, with sold-out status also announced directly to screen readers.