How to Hide Instructions In Your HTML Without Breaking Accessibility

You've probably seen this problem before. You need to include setup instructions, onboarding hints, or explanatory text in your markup, but you don't want them visible on the page under normal circumstances. The typical solution is some kind of modal, tooltip, or collapsible section that requires a lot of boilerplate JavaScript. There's a cleaner way.

The Instructions Are Not Included Pattern

The idea is simple. You place all your instructional text directly in the HTML, hidden from view using CSS. When a user triggers a specific state — clicking a help button, hovering over an element, or focusing on a field — the instructions appear. The instructions themselves are not included in the visual layout by default. They're in the DOM, they're accessible to screen readers, but they take up no space and draw no attention until needed. Here's the basic markup. It uses a `