Skip to main content

Performance, Accessibility and Tooling

Core Web Vitals​

MetricMeasuresGood
LCP (Largest Contentful Paint)Loading speed2.5 s or less
INP (Interaction to Next Paint)Responsiveness200 ms or less
CLS (Cumulative Layout Shift)Visual stability0.1 or less

Performance checklist​

  • Compress and size images; use modern formats (WebP, AVIF) and loading="lazy".
  • Set width and height on images to avoid layout shift.
  • Minify and split JavaScript; load non-critical scripts with defer.
  • Serve static assets with long Cache-Control lifetimes and hashed file names.
  • Use a CDN and HTTP/2 or HTTP/3.
  • Avoid render-blocking resources and large third-party scripts.
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<script src="analytics.js" defer></script>
<img src="hero.webp" alt="Students studying" width="1200" height="630" fetchpriority="high" />

Accessibility (a11y)​

PracticeWhy
Semantic HTMLScreen readers understand structure
Text alternatives (alt, captions)Non-visual access
Keyboard operability and visible focusNot everyone uses a mouse
Sufficient contrast (4.5:1 for body text)Readability
Labels for form controlsAssistive technology and larger click targets
ARIA only when HTML is not enoughThe first rule of ARIA: use a native element if one exists
<button aria-expanded="false" aria-controls="menu">Menu</button>
<ul id="menu" hidden>...</ul>

Test with the keyboard, a screen reader, and tools such as Lighthouse and axe.

Security basics​

  • Escape or sanitise untrusted content (prevent XSS).
  • Use HTTPS, HttpOnly and SameSite cookies, and a Content-Security-Policy.
  • Never put secrets in front-end code: anything shipped to the browser is public.

Tooling​

ToolUse
npm / pnpmPackage management
Vite, webpackBundling and dev server
ESLint, PrettierLinting and formatting
TypeScriptStatic types
GitVersion control