# Screen Reader Only Utility

## Objective

One tested way to add text for assistive technology without it appearing on screen.

A single visually hidden utility used for labels, instructions, and context that assistive technology needs and sighted users do not.

## Before You Begin

This feature is being added to an application that already exists and already
works. Do not scaffold a new project, and do not assume a blank slate.

Inspect the codebase first and establish:

- The existing application structure and where code of this kind already lives.
- The framework and version in use.
- The existing design system — colours, spacing, typography, and component conventions.
- Existing UI components you can reuse instead of writing new ones.
- The existing database structure, if this feature needs to persist anything.
- The existing authentication and authorization system, if this feature is user-scoped.
- Dependencies already installed, so you don't add a library that duplicates one.
- The existing test setup and conventions.

Only start writing code once you understand the above. If the application
already implements part of this feature, extend it rather than replacing it.

## Implementation Instructions

1. Find every place the app currently hides text from sight — off-screen positioning, zero dimensions, transparent colour, tiny font sizes, aria-label strings duplicating nearby copy — and consolidate them onto one utility.
2. Build it by clipping the element to nothing while keeping it rendered and in the accessibility tree: it must occupy no visual space and contribute nothing to layout, yet still be read in document order.
3. Provide a second variant that becomes visible when it receives focus, and use it for skip links and any other hidden content that is itself focusable.
4. Audit each existing usage as you migrate it and delete the ones where visible text would serve everyone better — a column header, a button label, or an error message usually belongs on screen.
5. Do not implement it with display none, visibility hidden, or the hidden attribute. Those remove the element from the accessibility tree as well as the screen, so the text is announced to nobody and the effort is wasted.

## UI and UX Requirements

Match the application's existing design system exactly. Reuse its components,
spacing, and typography. This feature should look like it was always there.

## Responsive Requirements

Works on mobile, tablet, and desktop. Touch targets are large enough to hit on a
phone, and nothing overflows horizontally at 320px.

## Accessibility Requirements

- Fully keyboard navigable.
- Correct semantic elements and ARIA roles.
- Visible focus states.
- Meets WCAG AA contrast.
- Dynamic changes are announced to screen readers.
- Respects prefers-reduced-motion.

## Edge Cases

- Hidden content that can take focus must become visible when focused, or a keyboard user tabs to something they cannot see and loses their place entirely.
- display none, visibility hidden, and zero width with zero height all remove the node from the accessibility tree; the utility must clip rather than remove, and a review should catch any regression back to them.
- Clipping breaks in familiar ways — an ancestor with overflow hidden, a transform creating a new containing block, or a flex or grid parent that still allocates a gap for the element — so the utility needs a fixed positioning context and no residual margin.
- Some cases do not want hidden text at all. Record in the utility's own documentation that visible labels, visible error text, and visible column headers are preferable, and that this utility is for supplementary context only.
- Line breaks and whitespace inside the hidden text are read aloud; keep the string a single clean sentence rather than formatted markup.
- Hidden text inside a control that also carries an accessible name will be concatenated with it, producing a doubled announcement — decide which source wins.
- Browser translation and text selection still reach the hidden text, so it must read sensibly if a user copies the surrounding block.

## Testing

Exercise the feature end to end in the running application. Cover every edge case
above, then run the existing test suite and confirm nothing regressed.

## Acceptance Criteria

- [ ] One utility covers every visually hidden string in the app, with no bespoke off-screen positioning left behind.
- [ ] Hidden text is present in the accessibility tree and read in document order.
- [ ] The focusable variant becomes fully visible on focus and returns to hidden on blur.
- [ ] No usage relies on display none, visibility hidden, or the hidden attribute.
- [ ] The utility survives overflow hidden, transformed, and flex or grid ancestors without leaking a scrollbar or a gap.
- [ ] Cases better served by visible text have been converted rather than hidden.
- [ ] The feature matches the existing design system.
- [ ] No existing functionality is broken.

## Adaptation Rules

- Match the existing design system. Do not introduce a new colour palette,
  spacing scale, or component library.
- Reuse existing components and utilities wherever they fit.
- Follow the naming, file layout, and code style already present.
- Do not upgrade, replace, or remove existing dependencies to make this
  feature fit. Adapt the feature to the app, not the app to the feature.
- Do not break existing functionality. If a change is genuinely required in
  existing code, make the smallest one that works and say so.
- If something in these instructions conflicts with how the application is
  built, follow the application and explain the deviation.

## Final Verification

Before you report the work as done:

1. Re-read the acceptance criteria above and check each one against what you
   actually built.
2. Run the application and exercise the feature end to end.
3. Run the existing test suite and confirm you have broken nothing.
4. Check the feature on mobile, tablet, and desktop widths.
5. Check keyboard navigation and focus handling.
6. Summarize what changed: files added, files modified, and anything you
   deliberately did differently because of how this application is built.

If any acceptance criterion is unmet, fix it before reporting completion.
