# Accessibility & UI polish

> Elevate perceived product quality with keyboard navigation, visible focus states, WCAG contrast, complete empty-loading-error states, and restrained motion.

- Canonical: https://exaspark.ai/docs/accessibility-and-motion/

## Why accessibility is inseparable from UI craft

Many builders treat accessibility as a late compliance checkbox. In reality, accessible engineering is the fastest way to make software feel unmistakably polished to *every* user.

Strong contrast stays readable outdoors in bright sunlight. Full keyboard navigation and clear focus rings let power users move rapidly through admin tables. Honest loading skeletons, thoughtful empty states, and crisp transitions make your app feel calmer and faster than cluttered rivals.

Requesting accessibility and UI-state polish explicitly lets ExaSpark wire semantic HTML, focus management, contrast discipline, and reduced-motion safeguards straight into your live components.

## Core WCAG standards every ExaSpark app should meet

Target **WCAG 2.1 AA** across all public screens and member dashboards. Six clear checks catch the vast majority of usability defects.

| Accessibility pillar | Practical target | What breaks in unpolished apps | How to verify in Preview |
| --- | --- | --- | --- |
| **Color contrast** | `>= 4.5:1` body text; `>= 3:1` headings, icons, and input borders | Faint grey placeholders or unreadable dark-mode pills | Inspect Light and Dark views and test muted labels |
| **Keyboard operability** | Every link, button, tab, menu, and modal works via `Tab`, `Enter`, `Space`, and `Escape` | Clickable `<div>` tags skipped by `Tab`; modals leaking focus | Complete sign-in or booking using only your keyboard |
| **Visible focus rings** | Clear, high-contrast `:focus-visible` outline on controls | Global `outline: none` hides active focus completely | Press `Tab` across navigation, cards, and inputs |
| **Semantic HTML** | One `<h1>` per page, ordered headings, native `<button>`, `<a>`, `<nav>`, `<main>` | Headings picked by size; buttons built from `<span>` | Verify heading order and clean page landmarks |
| **Form labels & errors** | Visible `<label>` tied to every input (`for`/`id`) + `aria-describedby` errors | Placeholder-only inputs that vanish while typing | Click each label to confirm focus moves into its input |
| **Icon buttons & media** | Descriptive `aria-label` on icon-only buttons and concise image `alt` text | Bare `X` or trash icons announced only as `"button"` | Inspect close, edit, delete, and menu icons |

## Designing all four UI states on every screen

Prototypes design only the populated happy path. Real software handles all four UI states cleanly so visitors never hit a silent blank rectangle.

### Loading skeletons that prevent layout shift

While fetching **Cloud** records, display a calm skeleton matching the approximate shape of incoming cards or table rows instead of an empty screen that jolts downward when data arrives. Inside submit buttons, show an inline spinner (`"Confirming..."`) with stable width so surrounding buttons never shift.

### Helpful empty states with one clear next action

A new member opening `/bookings` or filtering `/admin/orders` with zero matches should never stare at a bare table header. Provide one concise explanation (`"No upcoming classes yet"`) paired with one clear button (`"Browse weekly schedule"` or `"Clear filters"`).

### Actionable error states and quiet confirmations

Replace cryptic errors (`"500 Internal Server Error"`) with plain recovery guidance: state what failed briefly, confirm data is safe, and offer a one-click **Retry** or **Sign in again** button.

Confirm everyday actions — saving settings or checking in a guest — with a brief, non-blocking live-region toast (`aria-live="polite"`) rather than an intrusive popup dialog.

```text
Four-state screen audit:
[ ] Loading: geometry-matched skeleton or calm inline pending label
[ ] Empty: concise explanation + single relevant next-action button
[ ] Error: plain-English recovery message + Retry button
[ ] Populated: clear hierarchy, overflow rules, and crisp hover/focus states
```

## Restrained micro-interactions and reduced motion

Motion should clarify spatial transitions and confirm taps — never slow people down.

### Animate state changes, not decoration

Keep transitions fast and purposeful: `150ms–200ms` ease-out curves for drawers, tabs, hover hairlines, and modals. Skip sluggish `600ms+` bounce effects or scroll-hijacking animations that make practical apps feel gimmicky.

### Animate GPU-friendly properties and honor reduced motion

Transition `transform` and `opacity` rather than layout-triggering properties like `height`, `width`, or `top` so mid-range Android phones hold smooth 60fps frames.

Always wrap non-essential motion inside `@media (prefers-reduced-motion: reduce)` so users sensitive to movement get instant state switches or soft fades automatically:

```css
:focus-visible {
  outline: 2px solid var(--accent-primary, #1f5c4a);
  outline-offset: 2px;
  border-radius: 4px;
}

.interactive-card {
  transition: transform 160ms ease-out, border-color 160ms ease-out;
}

.interactive-card:hover {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
```

## Running a 10-minute accessibility and polish pass

Walk through this rapid checklist inside **Preview** and **Browser Device Lab** before publishing or packaging a Google Play `.aab` release.

1. **Tab through your main flow without a mouse** — Navigate the header, open a menu or modal, complete a form, press `Escape` to close overlays, and verify focus returns to the triggering button.
2. **Audit contrast in every active theme** — Inspect muted captions, placeholders, status badges, and links in Light mode (and Dark mode if enabled) for `>= 4.5:1` readability.
3. **Trigger all four UI states deliberately** — Test a brand-new account for empty states, submit invalid fields for inline error linking, and watch loading states during saves.
4. **Verify icon buttons and alt text** — Confirm every close, edit, delete, and menu icon carries a clear `aria-label`, while purely decorative icons use `aria-hidden="true"`.
5. **Check mobile touch comfort and animation smoothness** — Open [Browser Device Lab](https://exaspark.ai/docs/device-lab/) across Pixel and iPhone profiles to verify `>= 44×44px` tap targets and snappy transitions.

Run a comprehensive accessibility and four-state polish pass across an authenticated app:

> **Example prompt (App):** Run an accessibility and UI polish pass across all member and admin views without changing Cloud schemas or Stripe logic: replace clickable divs with native buttons or links, add high-contrast :focus-visible outlines globally, trap focus cleanly inside modals with Escape-to-close and focus restoration, add aria-labels to icon-only buttons, link visible labels and aria-describedby errors to every form input, and ensure every data screen has loading skeletons, helpful empty states, and retryable error banners.

Tighten contrast, heading semantics, and reduced-motion micro-interactions on a public website:

> **Example prompt (Web):** Polish visual craft and accessibility across our public site: verify WCAG AA contrast (4.5:1 body text, 3:1 controls) on all buttons, badges, and captions, add restrained 160ms ease-out hover and drawer transitions using transform and opacity only, honor @media (prefers-reduced-motion: reduce) globally, enforce one clean H1 per page with ordered headings, and confirm meaningful alt text on all product photos.

> **Note:** Real craft shows up in quiet details: a modal that closes on `Escape`, a form that keeps your input after a typo, a skeleton that never jumps, and muted copy readable outdoors.

## Common accessibility and polish gaps

Fix the six highest-impact craft gaps rapidly with this reference table.

| Defect spotted in Preview | User impact | Exact fix |
| --- | --- | --- |
| **Pressing Tab shows no visible focus outline** | Keyboard users lose track of active controls | Remove `outline: none` rules and apply a global `:focus-visible` ring token |
| **Pressing Escape leaves modals or drawers open** | Keyboard users feel trapped inside overlays | Bind `Escape` close, trap Tab focus inside dialogs, and restore trigger focus |
| **Icon-only X or trash buttons lack labels** | Screen readers announce only `"button"` | Add `aria-label="Close drawer"` and mark inner SVGs `aria-hidden="true"` |
| **Inputs use placeholders instead of visible labels** | Users forget field rules once typing begins | Render persistent `<label>` elements and reserve placeholders for short examples |
| **Empty list displays a blank white area** | New users assume the screen crashed | Add a calm empty state explaining why and offering one clear primary CTA |
| **Drawers or cards stutter on Android phones** | Animating `height` or heavy blur forces costly repaints | Animate `transform` and `opacity` (`150ms–200ms`) with reduced-motion fallback |

## Next steps

- [Responsive & dark mode](https://exaspark.ai/docs/responsive-and-dark-mode/) — Pair accessible contrast with crisp desktop, phone, and foldable themes.
- [Multi-page routes & forms](https://exaspark.ai/docs/forms-and-navigation/) — Combine inline form validation, URL state, and frustration-free wizards.
- [Brand systems & typography](https://exaspark.ai/docs/design-systems-and-brands/) — Build calm single-plane visual hierarchy and disciplined type scales.
- [Production checklist](https://exaspark.ai/docs/production-checklist/) — Run final pre-launch checks across security, DNS, Stripe, SEO, and UX.

## From the blog

- [Website accessibility basics](https://exaspark.ai/blog/website-accessibility-basics/) — Practical guide to contrast, labels, keyboard flow, and readable UI.
- [How to make a website load faster](https://exaspark.ai/blog/how-to-make-a-website-load-faster/) — Boost perceived speed with lean layouts and crisp loading states.
- [What to put on a homepage](https://exaspark.ai/blog/what-to-put-on-a-homepage/) — Pair high-craft clarity with strong visual hierarchy above the fold.
