An aria-valid-attr-value error means axe found an ARIA attribute whose rendered value failed the rule's checks. Inspect the flagged element and start with the value in the browser. A disclosure button might render aria-expanded="open" instead of "true", or its aria-controls might point to a panel ID left behind after a component rename.
What aria-valid-attr-value checks
Each ARIA attribute has a defined value type. An expanded state has a small set of allowed values. A relationship such as aria-controls takes one or more element IDs. Numeric attributes such as aria-level take an integer. Look up the value type for the exact attribute in the finding. Deque's axe rule reference, WAI-ARIA value types.
Axe reports unknown attribute names under aria-valid-attr. If the finding is aria-allowed-attr, check whether the element's role supports the attribute. A valid value still has to represent the current UI. For a disclosure, aria-expanded="true" describes a visible panel and "false" describes a collapsed one. Deque's rule index, W3C disclosure pattern.
Trace the rendered value to its source
- Reproduce the finding on the same route and in the same state. Inspect the element indicated by the axe result in DevTools. Write down the exact attribute and value.
- For a state value, check where the component maps its own state to ARIA. Values such as
open,1, or[object Object]can come from passing an application value straight through to the DOM. For a disclosure, derive the attribute from a boolean. - For an ID reference, look up the target in the rendered DOM. In an ordinary document, a value of
delivery-panelshould matchid="delivery-panel"exactly. Omit the leading#used in CSS selectors. If the attribute accepts multiple IDs, separate them with spaces and inspect each one. - Repeat the inspection after the relevant state change. Check whether a conditional render removes the target or whether two instances assign the same ID. Duplicate IDs need a separate fix even if a target lookup returns an element. Find and fix duplicate HTML IDs.
Fix the state and panel reference together
This button declares an unsupported expanded value and points to a different ID from the panel rendered below it.
<button id="delivery-toggle" type="button"
aria-expanded="closed" aria-controls="delivery-panel">
Delivery options
</button>
<div id="shipping-panel" hidden>
Standard delivery takes 3–5 business days.
</div>
Give the panel one stable ID. Start with the panel hidden and the button's state set to false. In the click handler, update both from the same boolean. The native button dispatches a click when activated with Enter or Space.
<button id="delivery-toggle" type="button"
aria-expanded="false" aria-controls="delivery-panel">
Delivery options
</button>
<div id="delivery-panel" hidden>
Standard delivery takes 3–5 business days.
</div>
<script type="module">
const toggle = document.getElementById("delivery-toggle");
const panel = document.getElementById("delivery-panel");
toggle.addEventListener("click", () => {
const expanded = panel.hidden;
panel.hidden = !expanded;
toggle.setAttribute("aria-expanded", String(expanded));
});
</script>
If a framework loads panel content on demand, keep the referenced wrapper mounted and place the loading and loaded content inside it. For a simple disclosure, W3C treats aria-controls as optional. If you retain it, keep its target consistent. An accordion, tabs, or combobox has its own pattern. For a plain show/hide section, consider letting the browser manage the expanded state with native details and summary. W3C disclosure pattern, native disclosure markup and tests.
Retest the disclosure in both states
The example assumes your Playwright baseURL points to the test app, /delivery renders the repaired markup, and @axe-core/playwright is installed in your test project.
import AxeBuilder from "@axe-core/playwright";
import { expect, test } from "@playwright/test";
test("delivery options expose the state that users see", async ({ page }) => {
await page.goto("/delivery");
const button = page.getByRole("button", { name: "Delivery options" });
const panel = page.locator('[id="delivery-panel"]');
await expect(panel).toHaveCount(1);
await expect(button).toHaveAttribute("aria-controls", "delivery-panel");
await expect(button).toHaveAttribute("aria-expanded", "false");
await expect(panel).toBeHidden();
const collapsed = await new AxeBuilder({ page })
.withRules(["aria-valid-attr-value"])
.analyze();
expect(collapsed.violations).toEqual([]);
await page.keyboard.press("Tab");
await expect(button).toBeFocused();
await page.keyboard.press("Enter");
await expect(button).toHaveAttribute("aria-expanded", "true");
await expect(panel).toBeVisible();
const expanded = await new AxeBuilder({ page })
.withRules(["aria-valid-attr-value"])
.analyze();
expect(expanded.violations).toEqual([]);
await page.keyboard.press("Space");
await expect(button).toHaveAttribute("aria-expanded", "false");
await expect(panel).toBeHidden();
});
This fixture assumes the disclosure is the first tab stop. On a full route, tab through the preceding controls or put a focused behavior test alongside a separate tab-order test. The explicit assertions catch state drift and duplicate or missing panel IDs even when the axe rule passes. Add the scenario to your website regression checks and verify the announcement with a screen reader as part of your pre-launch accessibility checks. Playwright accessibility testing guide.
Check the public route after deployment
Run a Slop Audit on your deployed page and open Accessibility violations when browser evidence is available. If the sampled page triggers aria-valid-attr-value, use the rule ID and reported selector to find the control. Rescan the same URL after deploying the repair and keep the interaction test for states that need a click or keypress.