Skip to content

fix(examples/chat): hero walkthrough keeps reading pauses under reduced motion - #979

Merged
blove merged 1 commit into
mainfrom
blove/hero-reduced-motion-pacing
Sep 3, 2026
Merged

fix(examples/chat): hero walkthrough keeps reading pauses under reduced motion#979
blove merged 1 commit into
mainfrom
blove/hero-reduced-motion-pacing

Conversation

@blove

@blove blove commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Problem (verified on production)

Under prefers-reduced-motion: reduce, HeroMode zeroed every scripted pause: moveCursor slept 0, press slept 0, and typeInto wrote the whole prompt in one shot — so the first prompt was typed and sent in the same tick, and a reduced-motion visitor never got a chance to read it. The spec intent for reduced motion is "typing is instant and the cursor jumps," not "no pacing at all."

Fix

In hero-mode.component.ts:

  • Added READ_PAUSE_MS = 1200 ("reduced motion removes animation, not reading time").
  • typeInto: under reduced motion, after the instant set, waits READ_PAUSE_MS so the prompt is visible before the cursor moves on.
  • moveCursor: under reduced motion, waits READ_PAUSE_MS / 2 (600ms) instead of 0 — the cursor jumps, then holds briefly so the target is readable.
  • press stays instant (0ms) under reduced motion.
  • Made reducedMotion an overridable public field (test seam, same pattern as bridge) instead of a readonly value computed once from matchMedia, so specs can flip it without mocking matchMedia globally.

The pauses run inside the existing driving() wrapper, so scriptDriving window semantics are unchanged.

Test evidence

Two new specs in hero-mode.component.spec.ts (real timers, timestamped):

  • reduced motion typeInto('abc') sets the textarea value synchronously but the returned promise takes ≥1200ms to resolve.
  • reduced motion moveCursor('composer') takes ≥600ms to resolve (not 0).

npx nx test examples-chat-angular: 177 passed (23 files), 0 failed.
npx nx lint examples-chat-angular: 0 errors (47 pre-existing warnings, unrelated to this change).

🤖 Generated with Claude Code

… reduced motion

prefers-reduced-motion previously zeroed every scripted pause, so the first
prompt was typed and sent in the same tick and a reduced-motion visitor never
got to read it. Reduced motion should remove animation, not reading time.

typeInto now waits READ_PAUSE_MS (1200ms) after the instant set; moveCursor
holds for READ_PAUSE_MS / 2 (600ms) instead of 0. press stays instant.
@blove
blove enabled auto-merge (squash) September 3, 2026 05:02
@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
threadplane Ready Ready Preview Sep 3, 2026 5:05am UTC

Request Review

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@blove
blove merged commit 93fb40f into main Sep 3, 2026
37 checks passed
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