Skip to content

feat: respect reduced motion in carousel animations - #211

Open
sanketio wants to merge 2 commits into
developfrom
feat/reduced-motion
Open

sanketio wants to merge 2 commits into
developfrom
feat/reduced-motion

Conversation

@sanketio

@sanketio sanketio commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Under prefers-reduced-motion: reduce, slide changes are instant and Autoplay / Auto Scroll do not start, including after interaction. Applied via Embla breakpoints, so it follows the setting live; save() output is unchanged.

Type of change

  • Bug fix
  • New feature
  • Enhancement/refactor
  • Documentation update
  • Test update
  • Build/CI/tooling

Related issue(s)

Closes #207

What changed

  • embla-options.ts: withReducedMotion() adds the reduced-motion breakpoint to core or plugin options.
  • view.ts: core duration: 0; Autoplay and Auto Scroll playOnInit: false, stopOnInteraction: true; isPlaying set from both plugins after init.
  • viewport/edit.tsx: editor slide changes are instant too.
  • docs/API.md, README.md, readme.txt: reduced-motion notes.

Breaking changes

  • Yes — migration path:
  • No

Testing

  • Unit tests
  • Manual testing
  • Cross-browser testing (if UI changes)

Test details:

  • npm run test:js, npm run lint:js, npm run lint:js:types, npm run lint:css, npm run build

How to test:

  1. Add three carousels to a page: one with Autoplay, one with Auto Scroll, one with Fade transition + Autoplay.
  2. Open the page, then DevTools → Cmd/Ctrl+Shift+P → "Rendering" → set "Emulate CSS media feature prefers-reduced-motion" to reduce.
  • Nothing moves on its own, before or after a reload.
  • Next/prev/dots jump to the slide with no slide or fade animation.
  • Setting the emulation back to "No emulation" resumes Autoplay and Auto Scroll.
  • With "Stop on interaction" off, drag the slides and release: nothing starts.
  • In the editor, with the same emulation, selecting a slide jumps without animation.

Checklist

  • I have self-reviewed this PR
  • I have added/updated tests where needed
  • I have updated docs where needed
  • I have checked for breaking changes

Copilot AI balanced review requested due to automatic review settings October 9, 2026 08:15

Copilot AI 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.

🟡 Changes recommended

Breakpoint ordering can allow another matching breakpoint to override the reduced-motion safeguards.

1 open finding
What changed in this PR

Adds reduced-motion support to carousel animations and automatic playback.

Changes:

  • Applies reduced-motion overrides to frontend and editor Embla options.
  • Prevents Autoplay and Auto Scroll from starting automatically.
  • Adds tests and accessibility documentation.
File Description
src/​blocks/​carousel/​viewport/​edit.tsx Disables editor slide animation under reduced motion.
src/​blocks/​carousel/​view.ts Configures frontend transitions and playback behavior.
src/​blocks/​carousel/​embla-options.ts Adds the reduced-motion breakpoint helper.
src/​blocks/​carousel/​__tests__/​view.test.ts Tests frontend reduced-motion options and state.
src/​blocks/​carousel/​__tests__/​embla-options.test.ts Tests breakpoint construction and merging.
README.md Documents reduced-motion support.
readme.txt Updates plugin accessibility documentation.
docs/​API.md Documents runtime reduced-motion behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/blocks/carousel/embla-options.ts
Copilot AI balanced review requested due to automatic review settings October 12, 2026 05:07

Copilot AI 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.

🟢 Approval recommended

The implementation preserves existing options, handles breakpoint precedence, and includes focused coverage for the new behavior.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

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.

[Enhancement]: Respect prefers-reduced-motion for slide transitions, Autoplay and Auto Scroll

2 participants