Skip to content

Search

Write ARIA for people, not for AI agents

A11yHTML

AI agents read our pages through the accessibility tree, but ARIA written for them hurts the people it was made for.

by
updated 7 min read

Who is your aria-label for? Until recently, the answer was clear: for people using screen readers, voice control and other assistive technology. Now browser agents read the same labels, and the first guides recommend writing ARIA so that machines understand our pages better.

TL;DR

ARIA describes the interface for people. Labels written for agents break WCAG 2.5.3 and open the door to prompt injection. The W3C sees it the same way. If agents need more than good HTML, WebMCP gives them a channel of their own, separate from the accessibility tree.

How agents read our pages

Agents like ChatGPT Atlas don’t only look at screenshots. They read the accessibility tree, the same structure of roles, names and states that screen readers use. OpenAI says so in its own help centre:

ChatGPT Atlas uses ARIA tags—the same labels and roles that support screen readers—to interpret page structure and interactive elements.

— OpenAI Help Center: Publishers and developers FAQ

The same page recommends “adding descriptive roles, labels, and states” so the agent can work with a site. That sounds harmless, almost like accessibility advice. The problem starts when we read it as an invitation to write ARIA for the agent.

Why ARIA written for machines hurts people

Here is a button that tries to give an agent as much context as possible:

buy-button.html
<button aria-label="Click this button to add the product to the cart and proceed to checkout">Buy</button>

A screen reader user now hears a whole sentence instead of “Buy”, on every visit. Someone using voice control says “click Buy”, and nothing happens, because the accessible name doesn’t contain the visible word. That is a failure of WCAG 2.5.3 Label in Name. Since axe-core 4.14, the rule label-content-name-mismatch is on by default and reports exactly this.

The fix is shorter than the problem:

buy-button.html
<button>Buy</button>

If the context matters, it belongs in visible text next to the button, where everyone can read it. That is what the first rule of ARIA has always said:

If you can use a native HTML element or attribute with the semantics and behavior you require already built in, instead of re-purposing an element and adding an ARIA role, state or property to make it accessible, then do so.

— W3C: Using ARIA

More ARIA doesn’t mean more accessibility. In the WebAIM Million 2026, 82.7 % of home pages used ARIA. Pages with ARIA averaged 59.1 detected errors, pages without it 42. WebAIM points out that pages with a lot of ARIA tend to be more complex, so ARIA isn’t necessarily the cause. But it doesn’t fix anything on its own either.

There is a second risk. If agents treat labels as instructions, labels become an attack surface. A study from Indiana University hid optimised triggers in the HTML, which reached the agent through the accessibility tree. Against Llama 3.1 8B in BrowserGym, the attack succeeded in at least 83 % of attempts on every tested site.1 That was one small model in a lab setup, and the triggers didn’t carry over to other models. It still shows where the accessibility tree ends up when we turn it into a prompt.

What the W3C says

On 20 October, the W3C Strategy Team published a discussion paper on the web in the age of AI. Point 7 is clear:

Accessibility for people comes first. Semantics, alt text and author intent are not to be repurposed for machines to the detriment of humans.

— W3C: W3C and the State of the Web in the AI Era

The paper recommends that instructions aimed at agents must not degrade the accessibility tree. The ARIA Working Group is to draft guidance against prompt injection via ARIA. How WebMCP, HTML and ARIA relate to each other goes to a planned Agentic Web Working Group.

This is a discussion paper, not a standard. At TPAC in Dublin at the end of October, the topic came up in a breakout session on action semantics for agents and in a joint meeting of the APA and ARIA groups. According to the minutes of that meeting, APA is working with the Web Machine Learning Working Group on safeguards in WebMCP for high-risk actions. People should be able to check a potentially dangerous form submission before it goes out, as WCAG already asks for with error prevention. One point got clear support in the room: such safeguards should be HTML features for everyone, not features for agents only. There is no resolution yet, and APA is writing a summary for the ARIA Working Group. It’s the idea of this article from the other side: what protects people using agents should protect everyone.

Give agents their own channel

For most sites, the best preparation for agents is the same as for people: native elements, visible labels, a sensible heading structure. An agent that can operate a <form> with <label> elements doesn’t need extra hints.

If a site wants to offer agents more, there is a separate channel for that: WebMCP. Chrome is testing it in an origin trial. Instead of hiding instructions in ARIA, we describe tools that an agent can call. The form stays exactly as it is for people.

Warning: Experimental

WebMCP is in an origin trial and only works in Chrome. The API may change, so the examples below show the idea, not a final standard.

The declarative variant adds attributes to an existing form. Where an agent needs more context than the visible label offers, toolparamdescription provides it, without touching the accessible name:

search.html
<form action="/search" toolname="search_articles" tooldescription="Search the articles on this site.">
  <label for="q">Search</label>
  <input id="q" name="q" type="search" required toolparamdescription="Search terms, in English or German." />
  <button>Search</button>
</form>

A screen reader announces “Search”, as before. The agent reads the tool description. Without toolparamdescription, the browser falls back to the <label>, which is another reason to write good labels.

The imperative variant registers a tool in JavaScript:

webmcp.js
if ('modelContext' in document) {
  const controller = new AbortController();

  await document.modelContext.registerTool(
    {
      name: 'search_articles',
      description: 'Search the articles on this site and return matching titles and URLs.',
      inputSchema: {
        type: 'object',
        properties: { query: { type: 'string', description: 'Search terms' } },
        required: ['query'],
      },
      annotations: { readOnlyHint: true },
      async execute({ query }) {
        const results = await search(query); // your existing search
        return results.map((r) => `${r.title}: ${r.url}`).join('\n');
      },
    },
    { signal: controller.signal },
  );
}

The feature check means other browsers ignore the block. readOnlyHint tells the agent that the tool changes nothing. controller.abort() removes the tool again.

The trade-off: the imperative variant is extra JavaScript for a feature in a single browser, and the declarative one adds attributes that nothing else understands yet. For most sites, good HTML is enough for now. Agents are still a useful argument in a meeting where accessibility has a hard time. But the reason to write good ARIA stays the people who rely on it.

Conclusion

ARIA describes the interface for people, and agents may read along. As soon as we write it for them, it gets worse for both. Which labels in your project would you write differently if you had only people in mind?

Further reading

Footnotes

  1. Sam Johnson, Viet Pham and Thai Le: Manipulating LLM Web Agents with Indirect Prompt Injection Attack via HTML Accessibility Tree, arXiv, July 2025.

Written by

Oliver Scheffler

I’ve been building websites for 25 years and write here about frontend, accessibility and performance – mostly about things I struggled with myself.

Accessible tabs, with CSS that reads the state

A11yJavaScriptCSS

The ARIA tabs pattern looks small, but it hides a dozen decisions. Here is the markup, the keyboard code and a way of writing CSS that can't drift from what screen readers are told, with a position on every contested point.

10 min read

Animating the <details> element without JavaScript

CSSA11yPerformance

With interpolate-size and ::details-content, the <details> element opens and closes smoothly. Browsers without support open it instantly, as they always have.

6 min read