# The full frontend review checklist

Open this while reviewing. Work the sections in order and report only what you find. Verified 2026-09 against https://www.w3.org/TR/WCAG22/, https://developer.mozilla.org/docs/Web/HTTP/CSP and https://developer.mozilla.org/docs/Web/API/Window/postMessage.

## Correctness

- Optional chaining used to silence a crash rather than handle a case — what should render when the value is missing?
- `0`, `''`, `false` and empty arrays treated as absent because the code tests truthiness.
- Two async results racing: does a slower earlier request overwrite a newer one? Is there a request id, an abort signal, or a `switchMap`?
- Cleanup on unmount and on navigation: fetches aborted, timers cleared, listeners removed, subscriptions torn down.
- Dates: is a timezone assumed? Is a `Date` mutated in place? Is parsing locale-dependent?
- Money: floating-point arithmetic on currency; formatting without `Intl.NumberFormat` and the right currency code.
- Every conditional render has a designed state: loading, empty, error, partial, and the "too many to show" case.
- Forms: validation on submit as well as on change; errors announced accessibly; the submit button disabled while in flight; double submit impossible; the form recovers after a failed submit without losing input.
- i18n: hard-coded user-facing strings; sentences assembled by concatenation (word order breaks); pluralisation via ICU rather than `n === 1 ? …`.

## Architecture and boundaries

- Does the change live in the right layer — feature, shared, or core? Does it import another feature's internals?
- Is a new abstraction backed by at least two real call sites? Premature generalisation costs as much as duplication and is harder to undo.
- Is business logic sitting inside a component where it can only be tested by rendering? Pure functions in a `model/` or `util/` module are cheaper to test and to read.
- Did a component's public API grow? Is the new surface typed, documented and consistent with the old one?
- New dependency: size in the bundle, last release date, licence, and whether the platform or an existing dependency already does it.

## Types

- Each `any`, `as unknown as` and `!` either fixed or carrying a comment saying why it is safe.
- Types derived from the source of truth (`typeof`, `keyof`, a generated API client) rather than hand-copied and free to drift.
- Discriminated unions instead of a shape where every field is optional and invalid combinations are representable.
- Function signatures narrow enough to reject wrong call sites: `id: OrderId` beats `id: string`.

## Accessibility — WCAG 2.2 AA

- Interactive things are `<button>`, `<a href>` or a real form control. A `div` with a click handler needs a role, `tabindex`, keyboard handlers and a focus style — three chances to get it wrong, so prefer the element.
- Every input has an associated `<label>`; every icon-only control has an accessible name; images have `alt`, empty `alt=""` when decorative.
- Focus is managed: moved into a dialog on open and restored on close, moved to the heading or the error summary after an async action, and sent somewhere sensible on route change.
- Focus is visible. A removed outline with no replacement is a blocker for keyboard users.
- Colour is never the only carrier of meaning (add an icon, text or pattern).
- Contrast: **4.5:1** for body text, **3:1** for large text (18pt, or 14pt bold), **3:1** for user-interface components and meaningful graphics.
- Target size ≥ **24×24** CSS px (SC 2.5.8, AA). 44×44 is the AAA figure — recommend it on touch-first UI, do not fail a PR on it.
- Async feedback is announced through `role="status"` (polite) or `role="alert"` (assertive); a toast nobody hears is not feedback.
- Motion respects `prefers-reduced-motion`; nothing auto-plays or auto-scrolls without a control.
- Headings form a real outline; landmarks (`main`, `nav`, `header`) exist; tables have headers with scope.

## Styling and CSS

- Specificity escalation and `!important` — usually a symptom that a component's styles are leaking or being fought.
- Global leakage: `::ng-deep`, `:global`, `ViewEncapsulation.None`, or selectors on element tags without a scope.
- Ad-hoc `z-index: 9999` instead of a documented scale.
- Hard-coded colours, spacing and font sizes where design tokens or CSS custom properties exist.
- Breakpoints invented per component instead of the shared set; layout that breaks between 320 px and 1920 px.
- `prefers-color-scheme` handled if the product has a dark theme; no hard-coded `#fff` backgrounds that punch holes in it.
- Logical properties (`margin-inline-start`, `padding-block`) where the product ships RTL locales.
- Animation on `transform`/`opacity` rather than `top`/`width`; `will-change` not left on permanently.

## SSR and hydration (if the app server-renders)

- `window`, `document`, `localStorage`, `navigator` touched at module scope or in a constructor rather than inside a browser-only hook (`afterNextRender`, `useEffect`) or behind a platform check.
- Markup that cannot match between server and client: `Date.now()`, `Math.random()`, locale-dependent formatting without a fixed locale, ids generated per render.
- Data fetched on the client that the server already had — check the transfer/serialisation mechanism is in place so hydration does not refetch everything.
- Anything reading a cookie or a user agent to branch rendering, which breaks CDN caching silently.

## Security (client side)

- Untrusted HTML reaching `dangerouslySetInnerHTML`, `[innerHTML]`, `bypassSecurityTrustHtml`/`bypassSecurityTrustUrl`, `lwc:dom="manual"`, or a template compiler. Sanitise, or render structured data instead.
- URLs from user or API data bound to `href`/`src` without a scheme allow-list — `javascript:` and `data:` are executable.
- Redirects built from a query parameter without an allow-list (open redirect, and a phishing vector on your own domain).
- Secrets, API keys, internal hostnames or tenant identifiers in client code or in a committed `.env`. A browser bundle cannot hold a secret at all.
- Authorisation decided only in the UI: a hidden button is not a protected action. The server must enforce it, and the review should ask whether it does.
- `postMessage` without checking `event.origin` (and posting with `'*'` as the target origin).
- `eval`, `new Function`, `setTimeout('string')`, or dynamic script injection from data.
- A new third-party script: does it pass CSP, does it carry `integrity`, has anyone measured what it costs, and what does it collect?
- Cookie-based sessions: is CSRF protection present (framework token, `SameSite`), and does the client send the token on state-changing requests?
- PII in `console.log`, analytics events, error reports or URL query strings.

## Performance (cross-stack only)

Stack-specific detail belongs to `angular-performance` / `react-performance` — link rather than restate. What this review catches:

- Waterfalls: sequential awaits that could run in parallel; a child fetching what the parent already has.
- Refetch storms: a dependency array or signal that changes identity on every render; polling with no backoff or stop condition.
- Work on the render path that should be memoised or precomputed: sorting, formatting, `JSON.parse`, `new Date()` per row.
- Long lists rendering every row, or a reorderable list keyed by index.
- Whole-library imports for one function; a heavy widget in the initial bundle.
- Images and embeds without reserved dimensions (layout shift) and without lazy loading below the fold.
- Listeners, timers, observers and subscriptions created without a matching teardown.

## Testing

Depth belongs to the stack's testing skill. What this review catches:

- New behaviour with no test at any layer; a bug fix with no test that fails without the fix.
- Assertions on implementation (state setters, private methods, class names) rather than what a user observes.
- Mocks of the code under test's own modules rather than of the network boundary.
- Flaky shapes: fixed `setTimeout` waits, long `waitFor` timeouts, index-based queries, order-dependent fixtures.
- A test that would still pass if the feature were deleted.

## Maintainability

- Names reveal intent: `isSubmitDisabled`, not `flag2`; booleans read as predicates.
- Comments explain *why*; a comment restating the code is noise that will go stale.
- TODOs carry a ticket reference, or they are wishes.
- Dead code, commented-out blocks, stray `console.log`, and finished feature-flag branches removed.
- Consistent with the repo's existing conventions even where you would personally choose otherwise — raise convention debates as `[question]`.
- Errors surfaced to the user meaningfully and reported to monitoring; no empty `catch`.

## Diff edge cases — what to output

| Situation | Output |
|---|---|
| Empty diff, or whitespace only | "No reviewable changes." and stop |
| Generated files only (`*.min.js`, snapshots, compiled output) | Name them, review nothing, note that the source should be reviewed instead |
| Lockfile-only | Review the dependency change the lockfile implies (new package, major bump, licence), not the lockfile lines |
| Vendored or third-party directory | Confirm it is vendored, check only the integration points |
| Over 400 non-generated lines | Ask for a split; meanwhile review the riskiest files and list what you did not read |
| Over 2 000 lines | Triage by risk (auth, payments, data migration, public API) and state plainly that the rest is unreviewed |
| Server files in the same PR | Review the client files; hand the rest to `backend-code-review` and say so in the summary |
