Your HTML Is an API Surface: 7 Patterns That Make Web Apps Easier to Automate A developer outlined seven HTML patterns that make web applications easier to automate, arguing that the DOM functions as an API surface for screen readers, browser automation, tests, crawlers, extensions, monitoring tools, and AI-powered browser agents. The patterns emphasize explicit semantics over visual styling, including using native button elements, separating form labels from placeholders, wiring error messages via aria-describedby, and exposing state through attributes like aria-disabled, aria-pressed, and aria-expanded. Modern frontend development usually treats HTML as the final output of a much larger system. We think about: React components state management APIs design systems JavaScript bundles server rendering caching performance Then somewhere at the end, all of that becomes HTML. That makes it easy to think of markup as implementation detail. But consider everything that may need to understand your interface without looking at it the way a human does: screen readers browser automation end-to-end tests search crawlers extensions monitoring tools AI-powered browser agents For all of them, the DOM is effectively an interface. That means your HTML is not merely presentation. It is an API surface. And like any API, it becomes significantly more reliable when its meaning is explicit. Here are seven practical patterns that make web interfaces easier for both humans and software to understand. One of the most common frontend shortcuts looks like this: Save Visually, there may be nothing wrong with it. Add CSS: .button { padding: 12px 20px; background: 2563eb; color: white; cursor: pointer; } Now it looks exactly like a button. But appearance does not define behavior. A machine inspecting the DOM sees a generic container with a click handler. Compare it with: Save changes The second version communicates several things automatically. It is interactive. It can receive keyboard focus. It has button semantics. It exposes a recognizable control to accessibility tools. Automation frameworks can identify it more reliably. And developers reading the source immediately understand what it does. React Example Avoid: