---
title: "How to make Storybook Interactions respect user motion preferences"
description: "Storybook's Interactions addon auto-plays simulated user interactions on page load and ignores the OS-level prefers-reduced-motion setting, which can disorient users or trigger seizures in people with photosensitive epilepsy or vertigo."
url: "https://swe.quest/articles/how-to-make-storybook-interactions-respect-user-motion-preferences-3b5b5019eae4e56d"
canonical: "https://github.blog/engineering/user-experience/how-to-make-storybook-interactions-respect-user-motion-preferences/"
source: "GitHub Engineering"
published: "2024-11-20"
difficulty: "medium"
kind: "How-to"
reading_minutes: 4
tags: ["accessibility","react","frontend","developer-tools"]
---

# How to make Storybook Interactions respect user motion preferences

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2024-11-20, 4 min read, How-to. Original: [https://github.blog/engineering/user-experience/how-to-make-storybook-interactions-respect-user-motion-preferences/](https://github.blog/engineering/user-experience/how-to-make-storybook-interactions-respect-user-motion-preferences/)

## Summary

Storybook's Interactions addon auto-plays simulated user interactions on page load and ignores the OS-level prefers-reduced-motion setting, which can disorient users or trigger seizures in people with photosensitive epilepsy or vertigo. A custom toolbar addon fixes this. It stores an interaction preference in localStorage, defaults it to disabled when matchMedia('(prefers-reduced-motion)') matches and no preference exists yet, and reloads the page when the user toggles it. Each story's play function then checks a shouldInteractionPlay() helper before running, so all users can opt in or out without changing OS settings.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Accessibility](https://swe.quest/tags/accessibility.md) (Web & mobile)
- [React](https://swe.quest/tags/react.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)

## Prerequisites

- React hooks ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- Storybook stories and play functions

## Keywords

Storybook, Storybook Interactions, prefers-reduced-motion, localStorage, matchMedia

## Related posts

- [Improving the Storage Access API in Firefox](https://swe.quest/articles/improving-the-storage-access-api-in-firefox-aed5f1c78b716040.md): Mozilla Hacks · 2022-02-08 · Medium · 6 min read · Browsers, Privacy, Identity & auth
  Ahead of enabling State Partitioning for all users, Firefox is changing its Storage Access API implementation in four ways.
- [What the iPhone Duo means for web development](https://swe.quest/articles/what-the-iphone-duo-means-for-web-development-ae876b58f98678e3.md): Mux · 2026-10-23 · Medium · 8 min read · Frontend, CSS, Browsers, Video & media, Mobile
  Safari on the foldable iPhone Duo exposes the Device Posture API and Viewport Segments API behind WebKit feature flags.
- [Two lines of Cross-Document View Transitions code you can use on every website today](https://swe.quest/articles/two-lines-of-cross-document-view-transitions-code-you-can-use-on-every-website-87eda278df990c07.md): WebKit · 2025-05-21 · Medium · 4 min read · CSS, Browsers, Frontend, Accessibility
  Adding \`@view-transition { navigation: auto; }\` to a site's CSS enables cross-document View Transitions, so elements shared between pages stay fixed and everything else crossfades instead of flashing blank between navigations.
- [Building Custom Animations in the Workflow Builder](https://swe.quest/articles/building-custom-animations-in-the-workflow-builder-94f541be651a6e1e.md): Slack Engineering · 2023-12-05 · Medium · 7 min read · React, Frontend, Product engineering
  Slack's Workflow Builder added drag-and-drop from a new steps sidebar into workflows by moving react-beautiful-dnd's DragDropContext to wrap the whole builder page, with two draggable/droppable lists.
- [Managing Focus Transitions in Slack](https://swe.quest/articles/managing-focus-transitions-in-slack-0a96821594858656.md): Slack Engineering · 2021-07-13 · Medium · 7 min read · Accessibility, React, Frontend, Design systems
  Slack built FocusTransitionManager, a React Context-based coordinator that lets sender components request focus moves via transitionFocusTo({focusKey}) and receiver components claim them via shouldTransitionFocus, so keyboard and screen-reader users don't lose focus when React re-renders remove the focused element.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
