npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reduced-motion

v1.0.4

Published

A simple, lighweight package that makes sure your animations do not run when the user motion preference is disabled.

Downloads

155

Readme

reduced-motion

A simple, lighweight package that makes sure your animations do not run when users disable animation preferences.

Features

  • Easy integration with any web project.
  • Focus on accessibility and user preference.
  • Lightweight and straightforward, with no dependencies.

Installation

Install reduced-motion using npm:

npm i reduced-motion

Or with yarn:

yarn add reduced-motion

Usage

After installing, import reduced-motion into your project:

import 'reduced-motion/css';

Or link directly in your HTML file:

<link rel="stylesheet" href="https://unpkg.com/reduced-motion/dist/index.min.css" />

How It Works

reduced-motion automatically applies styles that reduce motion when the user has indicated a preference for reduced motion through their system settings. It also removes video backgrounds, namely it targets the video elements which have the autoplay attribute.

Testing

To test the package once you've added it to your project, you simply need to disable animations on your device. Follow the steps below:

  • Windows 10: Settings > Ease of Access > Display > Show animations in Windows.

  • Windows 11: Settings > Accessibility > Visual Effects > Animation Effects

  • macOS: System Preferences > Accessibility > Display > Reduce motion.

  • iOS: Settings > Accessibility > Motion.

  • Android 9+: Settings > Accessibility > Remove animations.

  • Plasma/KDE: System Settings > Workspace Behavior -> General Behavior > "Animation speed" is set all the way to right to "Instant".

  • GTK/GNOME: Settings > Accessibility > Seeing > Reduced animation is turned on.

Performance concerns

This package utilises a media query to check if users have disabled animations on their devices. When this setting is detected, CSS overrides are activated to accommodate this preference. In cases where reduced motion is enabled, the package meticulously targets elements and pseudo-elements throughout the document. It adjusts animation timing, modifies the background-attachment property, and alters scroll behavior. Additionally, it hides video elements with the autoplay attribute to ensure a smooth and comfortable browsing experience for users sensitive to motion. This approach ensures minimal performance impact, activating only when users explicitly opt for reduced motion. Thus, it maintains an optimal balance between accessibility and efficiency.

Contributing

Check out the CONTRIBUTING.md for guidelines on how to proceed. Let's make the web more accessible to everyone.

Code of Conduct

This project is released with a Contributor Code of Conduct. By participating in this project, you agree to abide by its terms.

License

reduced-motion is available under the ISC License. See LICENSE for more info.