Skip to content

feat: add user-configurable motion preference#2905

Open
xseman wants to merge 3 commits into
basecamp:mainfrom
xseman:reduce-motion-config
Open

feat: add user-configurable motion preference#2905
xseman wants to merge 3 commits into
basecamp:mainfrom
xseman:reduce-motion-config

Conversation

@xseman
Copy link
Copy Markdown

@xseman xseman commented May 24, 2026

Man, I spent way too long thinking Fizzy had an animation bug because I couldn't reproduce the transitions I saw on another computer. Turns out it was just my OS blocking them! But honestly, closing cards feels so slow without the animations. So, I'm fixing it by letting users override the OS setting. I'm adding an "Always Animate" option that saves to localStorage and patches matchMedia so Turbo doesn't break.

output.mp4

Copilot AI review requested due to automatic review settings May 24, 2026 06:49
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a user-configurable “Motion” preference (auto / reduce / always animate) that influences global animation/transition behavior and view transitions.

Changes:

  • Adds a Motion settings UI and a Stimulus controller to persist/apply the preference.
  • Injects an early head script to set data-motion and adjust prefers-reduced-motion behavior.
  • Updates reset styles to apply reduced-motion rules based on html[data-motion="reduce"].

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
app/views/users/_theme.html.erb Adds Motion preference radio UI wired to a Stimulus controller.
app/views/layouts/shared/_head.html.erb Renders the new motion preference head partial.
app/views/layouts/_motion_preference.html.erb Adds inline head JS to set data-motion, remove view-transition meta, and override matchMedia.
app/javascript/controllers/motion_controller.js Implements persistence + DOM updates for the Motion setting.
app/assets/stylesheets/reset.css Switches reduced-motion styling from media query to data-motion selector.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/assets/stylesheets/reset.css
Comment thread app/assets/stylesheets/reset.css
Comment thread app/views/layouts/_motion_preference.html.erb
Comment thread app/javascript/controllers/motion_controller.js Outdated
Comment thread app/views/users/_theme.html.erb
Comment thread app/views/users/_theme.html.erb
xseman added 2 commits May 24, 2026 16:30
Users who have prefers-reduced-motion set at the OS level but are
browsing without JavaScript would receive no reduced-motion treatment
after the @media block was removed. Restore it with a
:not([data-motion="animate"]) guard so JS-driven "Always animate"
mode still overrides it while keeping the no-JS safety net.
The comment "absent → patch falls through to OS" was misleading because
the attribute is immediately re-set on the next line. Clarify that the
deletion is intentionally transient: it temporarily removes the attribute
so the matchMedia patch reads the real OS value before resolving to the
binary reduce/animate state.
@xseman
Copy link
Copy Markdown
Author

xseman commented May 24, 2026

Also, if this feature is out of scope for now, what if we just add a small note in the profile section? Something like: You have prefers-reduced-motion: reduce enabled, so transitions are turned off.

It's pretty much what Google does in their transition examples here https://view-transitions.chrome.dev/stack-navigator/mpa-prerender/

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.

2 participants