Skip to content

Treat --slomo 0 as 0 so reduced motion skips the motion waits - #91

Open
RobbieTheWagner wants to merge 2 commits into
media-redesignfrom
fix/reduced-motion-slomo
Open

RobbieTheWagner wants to merge 2 commits into
media-redesignfrom
fix/reduced-motion-slomo

Conversation

@RobbieTheWagner

@RobbieTheWagner RobbieTheWagner commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Why

We want to merge media-redesign into main with confidence, and review found that reduced motion still makes visitors wait out animations that no longer run. Under prefers-reduced-motion, propflip.css sets --slomo: 0. The rail re-form in Layout.astro read it with parseFloat(...) || 1, so 0 became 1 and the rail kept its pieces out of flow for the full ~760 ms. The hover release in Layout.astro and every timer in explorer.ts had the same || 1 fallback.

What changed

  • motion/propflip.ts exports slomo(el = document.documentElement). It returns the parsed --slomo and falls back to 1 only when the value is missing (NaN), never when it is 0.
  • The four readers use it: the rail re-form and the hover release in Layout.astro, the explorer's timers (its private slomo() is gone), and the island's settle timer in Island.tsx.
  • The hover release used to read only the inline --slomo on <html>, so it ignored the reduced-motion value entirely. It now reads the computed value like the others.
  • Normal-motion timings are unchanged.
  • tests/e2e/shell.spec.ts gains two tests that drag the divider past the middle and time how long the rail stays re-forming: over 600 ms with normal motion, under 200 ms with reduced motion.
  • tests/unit/Island.test.tsx sets --slomo: 0 on the island in the one test that waits 80 ms for it to land. jsdom has no stylesheet, so the island used to read a missing value as 0 by accident. It now gets the default of 1.

Verification

  • Probe in Chromium on the dev server, timing from data-reforming set to cleared during a divider drag: 28 ms with reduced motion, 812 ms with normal motion.
  • New e2e tests, chromium: pass 3 of 3 runs each. With the source fix stashed, the reduced-motion test fails with 792 ms.
  • shell.spec.ts, chromium: 24 passed, 1 failed. The failure is search palette › closes the now-playing card first, so ⌘K always works (expected 0, received 16). It fails the same way with the fix stashed, so it predates this change.
  • explorer.spec.ts, player.spec.ts, player-phone.spec.ts, chromium: 38 passed.
  • pnpm lint: clean. pnpm test:unit: 273 passed. pnpm build: 0 errors.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Motion timing is now applied consistently across the explorer, dialogs, and navigation rails. Reduced-motion settings also result in faster rail settling.
  • Tests
    • Added checks for motion timing with standard and reduced-motion settings, plus coverage for configured motion speed and its default.

Under prefers-reduced-motion propflip.css sets --slomo to 0, but the rail
re-form, the hover release and the explorer read it with `|| 1`, so 0
became 1 and they still waited out the full animation. One slomo() in
motion/propflip.ts now reads it for every caller, falling back to 1 only
when the property is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
starpod Ready Ready Preview Nov 30, 2026 7:20pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PR adds a shared slomo function and replaces local --slomo reads in explorer, island, and rail timing code. Tests cover the helper’s values and rail re-form timing.

Changes: Shared slomo timing

Layer / File(s) Summary
Shared helper and explorer adoption
packages/starpod/src/motion/propflip.ts, packages/starpod/src/components/explorer/explorer.ts, tests/unit/propflip.test.ts
propflip.ts exports slomo, which reads the computed --slomo value and returns 1 when parsing yields NaN. Explorer uses the shared function instead of its local implementation. Unit tests cover zero, configured, and default values.
Component timing integration and validation
packages/starpod/src/components/media/Island.tsx, packages/starpod/src/layouts/Layout.astro, tests/unit/Island.test.tsx, tests/e2e/shell.spec.ts
Island settling, rail re-form, and hover-release timing use slomo. The island test sets --slomo to 0; Chromium end-to-end tests check normal and reduced-motion rail re-form timing.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 680d2

This change makes reduced-motion settings skip motion waits instead of treating a zero slowdown value as the default. No concrete regression has been identified, and the change is low risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: zero values of the --slomo CSS variable are now read as 0 instead of falling back to 1, so reduced motion skips the motion waits. The changeset matches this. The adde…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: zero values of the --slomo CSS variable are now read as 0 instead of falling back to 1, so reduced motion skips the motion waits. The changeset matches this. The added shared slomo() helper, the call-site updates in Layout.astro, explorer.ts, and Island.tsx, and the new tests all support the title's claim.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 49cc054 and 680d20c.

Files selected for processing: 7

  • packages/starpod/src/components/explorer/explorer.ts
  • packages/starpod/src/components/media/Island.tsx
  • packages/starpod/src/layouts/Layout.astro
  • packages/starpod/src/motion/propflip.ts
  • tests/e2e/shell.spec.ts
  • tests/unit/Island.test.tsx
  • tests/unit/propflip.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

CI failed the new re-form tests in Firefox and WebKit. --slomo reads 0
under reduced motion in all three browsers, but headless WebKit took
560ms for two idle frames and Firefox's hold swung with load, so a
wall-clock bound there measured the runner, not the fix. The timing
tests now run in Chromium only, and slomo() gets unit tests that fail
on the old `|| 1` read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 680d20c9 Deployed Nov 30, 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