Topic 2 of 4 · 4 min read
Checking states, breakpoints and themes
Goal: Walk an AI-built screen through its loading, empty, error, long-content, mobile and dark-mode states and log what breaks.
An AI-built screen is only reviewed when you have seen it loading, empty, failing, overfull, small and dark, not just in the one state the design showed. Generated UI is usually built for the happy path with short sample content.
Check yourself · 1 of 3
Which test best reveals an overflow bug in a generated card layout?
Why it matters
A prompt-to-UI tool or coding agent sees one mock-up with tidy data. It will build that. The real product has slow networks, new users with nothing yet, failed requests, names that are 60 characters long, phones, and people on dark mode. These states are where users meet the product most, and where generated code is weakest.
How to do it
Make a short table with one row per state and walk the screen through each.
- Loading. Slow the network in dev tools. Is there a skeleton or spinner? Does the layout jump when data arrives?
- Empty. Return no data. Is there an explanation and a next action, or a blank area?
- Error. Make the request fail. Is the message specific, near the action, with a way to retry? A generic "Something went wrong" alone is a defect.
- Long content. Use a long name, a long word without spaces, 200 list items, a translated string that is 40 percent longer. Check wrapping, truncation and overflow.
- Small screens. Resize to a phone width. The WCAG reflow guidance expects content to work at 320 CSS pixels wide without scrolling in two directions. Check tap targets and fixed widths.
- Dark mode and themes. Switch the system setting. Look for text that vanishes, hard-coded white backgrounds and unreadable borders. CSS media features such as
prefers-color-schemeare how pages respond. - Keyboard and zoom. Tab through the screen and zoom to 200 percent.
An automated checker such as axe-core finds missing labels and low contrast. It does not find a layout that falls apart.
Before and after
Weak: "Checked mobile, looks fine."
Fixed: "Checkout at 320 px: the price column overflows and the Pay button is cut off. Error state: payment failure shows a red toast that disappears after 2 seconds and the form is cleared. Dark mode: input text is dark grey on a dark grey field."
What goes wrong
- Testing only your own window size.
- Checking states with perfect data. Sample names hide every overflow.
- Trusting the agent's "responsive". It may mean one media query.
- Skipping the error path because it is hard to trigger. Use a mock or a dev tools block rule.
Examples
A state log
| State | Result |
|---|---|
| Loading | Skeleton shows, layout jumps 40 px on load |
| Empty | Blank area, no message |
| Error | Toast only, form cleared |
| Long name | Overlaps the avatar |
| 320 px | Button cut off |
| Dark | Placeholder text invisible |
The unbroken string
A comment field accepts a 90-character URL with no spaces. The agent's card has a fixed width and no wrapping rule, so the text runs under the next column. Tidy sample data never showed it. Pasting one long string does.
Key points
- Review a screen in every state: loading, empty, error, long content, small screen and dark mode, not just the designed one.
- Use hostile content on purpose: very long names, unbroken strings, hundreds of items and longer translations.
- Content should work at 320 CSS pixels wide without scrolling in two directions, according to the WCAG reflow guidance.
- Error states must say what failed and what to do next, near the action that failed.
- Automated checkers like axe-core catch missing labels and contrast; they do not catch broken layouts, so look at the screen too.
Common mistakes
- Reviewing only at your own screen width and only with tidy sample data.
- Skipping the error state because it is hard to trigger instead of mocking the failure.
- Trusting an automated accessibility scan to confirm the layout works.
- Calling a screen responsive after checking one phone width.
Check yourself · 2 of 3
An agent's screen shows a blank area when the list has no items. What is the defect?
Check yourself · 3 of 3
A failed payment request clears the form and shows a toast for two seconds. What should you log?
Practice items, not counted towards your mastery.
Start here
- Visual comparisons (Playwright docs) (opens in a new tab)DocsFree
How screenshot assertions create baselines, set thresholds and mask unstable areas.
- Visual tests (Storybook docs) (opens in a new tab)DocsFree
Catching visual changes per component and state, and reviewing them before they merge.
- axe-core (Deque) (opens in a new tab)ToolFree
The open-source rules engine that checks rendered pages for contrast, labels and other accessibility faults.
More for this topic
- Understanding Reflow (WCAG 2.2) (opens in a new tab)StandardFree
The standard for content that must work at 320 CSS pixels wide without two-way scrolling.
- Using media queries (MDN) (opens in a new tab)DocsFree
How breakpoints and prefers-color-scheme work, so you know what to test.