Reduced motion: honor prefers-reduced-motion for video + logo, add hero pause control (#1294)#1353
Merged
Merged
Conversation
…ause control (#1294) Three motion sources now respect the OS-level prefers-reduced-motion preference, plus a WCAG 2.2.2 (Pause, Stop, Hide) pause mechanism for the auto-moving hero. - New shared helper window.MakeLab.prefersReducedMotion() (reduced-motion.js), queried live so an OS toggle mid-session is respected; loaded before carousel.js and consulted by the makelab-logo.js module too. - Hero video: keep autoplay in the markup (progressive enhancement — the no-JS baseline still plays); carousel.js pauses the active video under reduced motion / the pause control so the poster shows. Poster comes from the banner's existing image when set (no model change). - Logo canvas: under reduced motion, pin the morph to its assembled end state (lerp = 1), skip the scroll handler, and drop "Animated" from the label. - WCAG 2.2.2: one visible, keyboard-operable pause/play toggle governing both the auto-advance and the looping video. Ships hidden so no-JS users never see a dead control; carousel.js reveals it only when motion exists. - Regression tests: hero video keeps autoplay, gets a poster only when the banner has an image, and the pause control renders. Refs #1196, #1288, #1293. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1294.
Makes the three remaining motion sources honor the OS-level
prefers-reduced-motionpreference, and adds a WCAG 2.2.2 (Pause, Stop, Hide, Level A) pause mechanism for the auto-moving hero. No in-page motion toggle (that was rejected in #1196).Approach — progressive enhancement
CSS can't stop
<video>playback or a<canvas>loop, so JS is genuinely required for those. Guiding principle: the no-JS HTML baseline delivers the content; JS only removes motion for people who asked for less.<video>keepsautoplay muted loop— JS-disabled users get the video exactly as today (no regression). JS pauses it under reduced motion / via the pause control; it never enables it.<source media="(prefers-reduced-motion: no-preference)">trick — Chrome/Safari droppedmediaon<video>/<source>(Firefox-only now).Three surfaces tied together by one shared helper and one pause control.
Changes
js/reduced-motion.js(new): sharedwindow.MakeLab.prefersReducedMotion(), queried live (an OS toggle mid-session is respected without reload). Loaded beforecarousel.js; themakelab-logo.jsmodule reads it too.base.html+carousel.js): keepautoplay; add aposterfrom the banner's existingimagewhen set (no model change);carousel.jspauses the active video under reduced motion so the poster shows.makelab-logo.js): under reduced motion, pin the morph to its assembled end state (lerp = 1), skip the scroll handler (keepResizeObserverfor sizing), and drop "Animated" from the canvas label.base.html+carousel_fade.css+carousel.js): one visible, keyboard-operable Pause/Play toggle governing both the auto-advance and the looping video. Real<button>, dynamicaria-label/icon, ≥44×44 target, contrast chip, focus ring. Shipshiddenso no-JS users never see a dead control;carousel.jsreveals it only when motion exists.Testing
test_hero_motion.py): hero video keepsautoplay, gets aposteronly when the banner has an image, and the pause control renders. 4/4 pass.Screenshots
Refs #1196, #1288, #1293.
🤖 Generated with Claude Code