Accessibility Built Once: Shared Components and Tests That Query by Role
Why accessibility is cheapest in the UI's shared components, and how tests that find elements by role and name double as an accessibility check.
Open the network panel on the trip summary screen of a ride-sharing app and watch four requests fire: the trip, the driver, the vehicle, the receipt. The screen joins them, retries the flaky one, and shows a different apology depending on which call failed. Nobody decided that the UI would become an integration layer. It simply happened, one screen at a time.
When an API is shaped around general-purpose resources, the screen that needs a bit of each has to do the assembling. That work is cheap to start and expensive to keep. The same stitching is repeated by every client, the loading states multiply, and a partial failure leaves the page half drawn.
The book's remedy is an endpoint in the API layer built for one screen, the pattern usually called a backend for frontend. It composes existing Tools and returns precisely what the screen displays, which keeps the joining work on the server and leaves the screen with little to do. For the trip summary, that means one call and one failure to handle.
A screen-shaped endpoint is easy to misuse. Its job is composition: gather, rename, trim. The moment it starts deciding things, such as whether the rider qualifies for a refund, you have created a second home for business rules, with the usual consequences. Decisions still belong in a Tool, and the endpoint only calls it. A good smell test is whether the endpoint's code would make sense to someone who has never seen the business rules.
The second job at the seam concerns what goes wrong. The network speaks in numbers and users do not. Left alone, every component ends up with its own idea of what a failure means:
// BookingForm.tsx
if (res.status === 409) toast("That slot was just taken");
// WaitlistButton.tsx
if (res.status === 409 || res.status === 412) openConflictModal();
// RescheduleLink.tsx
if (!res.ok) toast("Something went wrong");
Three components, three behaviours, one underlying event. Add a rate-limit response next year and each file has to be found and edited.
The book puts the translation in a single place inside the UI's service code, and components are handed a handful of UI-level outcomes instead of raw numbers. I like that choice, and a few design notes from general practice make it work better:
Both jobs rest on the same observation: the boundary is the narrowest point of contact between the layer that changes most and the layer beneath it. Narrow contact means that most redesigns never touch the API, and most API changes surface in one place. The book strengthens the arrangement by having the typed client the UI calls through be generated from the API specification, so that a contract change is reported by the compiler rather than discovered in production.
The same seam is where Axiom A6 does its work from the other side. The UI may know the published contract, and it may not know how the layers behind it are built. Everything above is the practical consequence of that rule: the screen asks for what it needs, and the API layer worries about where it comes from.
Put assembly on the server side of the seam and interpretation on the UI side, each in exactly one place. Screens then stay small, errors read the same everywhere, and nothing deeper needs to know what a button looks like. For the API layer's side of this arrangement, see REST at Layer 5, and for how the UI handles the data it receives, thin components and honest state.