WordPress fix

Before and after

Broken — before
<?php // woocommerce/loop/orderby.php (Broken custom override missing label/aria-label) ?>
<form class="woocommerce-ordering" method="get">
  <select name="orderby" class="orderby">
    <?php foreach ( $catalog_orderby_options as $id => $name ) : ?>
      <option value="<?php echo esc_attr( $id ); ?>" <?php selected( $orderby, $id ); ?>>
        <?php echo esc_html( $name ); ?>
      </option>
    <?php endforeach; ?>
  </select>
</form>
Fixed — after
<?php // woocommerce/loop/orderby.php (Fixed with wp_unique_id() + accessible <label>) ?>
<?php $orderby_id = wp_unique_id( 'wc-orderby-' ); ?>
<form class="woocommerce-ordering" method="get">
  <label for="<?php echo esc_attr( $orderby_id ); ?>" class="screen-reader-text">
    <?php esc_html_e( 'Sort products by', 'mytheme' ); ?>
  </label>
  <select
    id="<?php echo esc_attr( $orderby_id ); ?>"
    name="orderby"
    class="orderby"
  >
    <?php foreach ( $catalog_orderby_options as $id => $name ) : ?>
      <option value="<?php echo esc_attr( $id ); ?>" <?php selected( $orderby, $id ); ?>>
        <?php echo esc_html( $name ); ?>
      </option>
    <?php endforeach; ?>
  </select>
</form>
Live preview

Fixed vs. broken example

Passes select-name
Accessibility tree: role="combobox", accessible name="Sort products by", value="Featured"

Avoid relying on a dummy first <option> like "Sort by..." as the sole label; once a user picks an option, the purpose disappears for everyone.

Automated test

Playwright + axe-core check

tests/a11y-select-name.spec.ts
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";

test("WooCommerce catalog ordering and product variation selects pass select-name", async ({ page }) => {
  await page.goto("/shop/");
  await expect(page.getByRole("combobox", { name: /sort products by/i })).toBeVisible();
  const results = await new AxeBuilder({ page })
    .withRules(["select-name"])
    .analyze();
  expect(results.violations).toEqual([]);
});

Template deduplication tip

An unlabeled <select name='orderby'> in woocommerce/loop/orderby.php fires on every shop, category, and tag archive URL. Fixing that one PHP template override resolves the entire store cluster.

Screen readers

What NVDA and VoiceOver announce

E-commerce variant pickers (Size, Color), collection sort dropdowns, and country selectors without a programmatic <label> or aria-label announce only the first option ('Featured' or 'Small'), hiding what the dropdown controls.

NVDA (Windows)

Broken

"combo box, Featured, collapsed" (purpose of selector unknown)


Fixed

"Sort products by, combo box, Featured, collapsed"

VoiceOver (macOS / iOS)

Broken

"Featured, pop-up button"


Fixed

"Sort products by, Featured, pop-up button"

Common questions

Why did my WooCommerce shop fail select-name after installing a custom theme?
WooCommerce core includes aria-label on loop/orderby.php, but many older third-party themes ship outdated template overrides that drop aria-label. Inspect your child/parent theme's woocommerce/loop/orderby.php.
How do I label WordPress's wp_dropdown_categories() widget output?
Pass an explicit id argument to wp_dropdown_categories( array( 'id' => 'cat-filter' ) ) and print a matching <label for='cat-filter'>Filter by category</label> immediately before it.
Do WooCommerce Select2/SelectWoo enhanced dropdowns also need a label?
Yes—both the underlying native <select> and any generated combobox/search input must inherit an accessible name from the original <label for> binding.