Sub topic 3
Hover, Focus, Active, Disabled, and Error States
Assume you know basic HTML and CSS, can open DevTools, and can read a design file. A visual QA pass must inspect more than the default page. Interactive states often reveal missing styles, poor contrast, or layout changes.
Check states and edge cases
Test every interactive control in these states:
- Hover: Move the pointer over it. Check color, border, shadow, cursor, and whether nearby content moves.
- Focus: Use the keyboard to reach it. Confirm a clear focus indicator remains visible.
- Active: Hold the mouse button or activate the control. Check pressed styling and timing.
- Disabled: Confirm the control looks unavailable and cannot be activated. Do not rely on color alone.
- Error: Submit invalid input. Check the message, icon, border, spacing, and association with the field.
Also test long labels, empty lists, missing images, and unusually long error messages. Text should wrap without overlapping controls. Empty states should match the design instead of leaving unexplained blank space. Missing images need an intentional fallback.
Accessibility and real environments
At 200% text zoom, confirm that content reflows and remains usable. Enable reduced motion and check that transitions stop or become less distracting. Test with a keyboard, not only a pointer.
Compare the page in the main supported browsers and on at least one real phone. Browser font rendering, viewport units, touch behavior, and device pixel density can create differences that desktop emulation misses.
> callout note > A screenshot can prove that a state looks correct, but it cannot prove that a keyboard user can reach it or that an error is announced correctly.
Automate and triage
Use screenshot tests for stable, important states. Keep viewport, browser, fonts, and test data fixed so differences are meaningful.
import { test, expect } from '@playwright/test';
test('button states match the baseline', async ({ page }) => {
await page.goto('http://localhost:3000/form');
await expect(page).toHaveScreenshot('form-default.png');
await page.getByRole('button', { name: 'Save' }).hover();
await expect(page).toHaveScreenshot('form-save-hover.png');
await page.keyboard.press('Tab');
await expect(page).toHaveScreenshot('form-save-focus.png');
});Classify findings by user impact:
- Blocker: a state is unusable, unreadable, or hides content.
- Major: layout or interaction differs from the approved design.
- Minor: a small spacing, color, or rendering difference with limited impact.
A useful report includes the URL, browser, viewport, state, steps, expected result, actual result, and screenshot. Identify the affected component and attach the design reference. “Button looks wrong” is not reproducible; “At 375 px in Safari, the focused Save button loses its 2 px outline after pressing Tab” is.
Exercise
What details make a visual discrepancy reproducible?
Show answer
Record the URL, browser, viewport, interaction steps, expected and actual results, affected component, and screenshots.