Skip to content

feat(cli): emulate media everywhere, and add check - #128

Open
totigm wants to merge 1 commit into
feat/cli-viewport-sweepfrom
feat/cli-media-emulation
Open

totigm wants to merge 1 commit into
feat/cli-viewport-sweepfrom
feat/cli-media-emulation

Conversation

@totigm

@totigm totigm commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Stacked on #127 → #126 → #125 → #118.

This closes the loop on the very first thing reported as a blocker: a landing page whose reduced-motion path shipped untested, because there was no way to render it under prefers-reduced-motion: reduce short of changing an OS setting.

Media flags on every command

--reduced-motion, --color-scheme <light|dark> and --forced-colors, applied before the first navigation so a page that reads the preference once at boot still sees it.

npx @humanjs/cli demo https://your-app.com --reduced-motion --record motion.mp4

Verified against humanjs.dev: 12 actions recorded, scroll sequence and all, under reduced motion. That is the exact check that was impossible before, and no screenshot could ever have made it — the difference is in movement.

check <url>

checked https://example.com at 1280×800

  baseline       humanjs-check/baseline.png
  dark           humanjs-check/dark.png
                 identical to baseline — the page may have no branch for it
  forced-colors  humanjs-check/forced-colors.png
                 renders differently from baseline
  reduced-motion humanjs-check/reduced-motion.png
                 a still cannot show this — record under it instead:
                 humanjs demo <url> --reduced-motion --record motion.mp4

The screenshots are not the feature; the comparison is. Four PNGs are four PNGs somebody has to open side by side. A condition that renders byte-identical to baseline is a page that very likely has no branch for it, and that is actionable.

Checked against two sites picked to prove the report distinguishes them:

Site dark forced-colors
example.com (no theme) identical — correct differs
humanjs.dev (has a theme) differs — correct differs

The line I was careful about

Reduced motion is excluded from the verdict on purpose. Its difference is in movement, not layout, so a still cannot settle it either way — and reporting "identical to baseline" there would read as a finding when it means nothing. The command says what it cannot show and points at the recording route instead. There is a test asserting that line never renders a verdict.

Verification

132 unit tests in @humanjs/cli (was 112): flag parsing including a rejected --color-scheme sepia, the emulation payload built for each combination, the log naming CSS features rather than flag names, condition metadata, fingerprint stability, and each verdict's wording.

Whole suite: lint, typecheck (11/11), test (10/10), build (8/8), check:exports (15/15).

Note

page.emulateMedia is called directly, matching how the CLI already reaches for page elsewhere. Once #116 lands, this can route through human.emulateMedia instead — left out here so the two stay independently mergeable.

🤖 Generated with Claude Code

The original report that started this work said the blocker was being
unable to verify a landing page's reduced-motion path -- it shipped
untested. --reduced-motion, --color-scheme and --forced-colors close
that, applied before the first navigation so a page reading the
preference at boot still sees it. Paired with --record, the motion path
can finally be watched, which a screenshot could never show.

check renders the page under all five conditions and compares them. The
screenshots are not the point; the comparison is. A condition that
renders byte-identical to baseline is a page that very likely has no
branch for it.

Reduced motion is deliberately excluded from that verdict. Its
difference is in movement, not layout, so a still cannot settle it --
the command says so and points at the recording route rather than
implying a conclusion it cannot support.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
humanjs Ready Ready Preview Sep 9, 2026 9:04am UTC

This branch was successfully deployed

1 active deployment
Preview — de34beaa Deployed Sep 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant