Honor prefers-reduced-motion in Bootstrap Templates

Honor prefers-reduced-motion in Bootstrap Templates

You bought or inherited a Bootstrap template, and it moves a lot: a sliding hero, cards that lift on hover, sections that fade in as you scroll, anchor links that glide. Some visitors have told their operating system they want less of that, and your page may be ignoring them.

To honor prefers-reduced-motion in a Bootstrap template, keep Bootstrap’s built-in handling switched on, gate every decorative effect your template adds behind (prefers-reduced-motion: no-preference), never start a carousel on its own, and leave all content visible without scrolling into an animation trigger. The media feature only reports a preference. Each effect still has to read it, and the code that owns the effect is what you have to fix.

This post is for developers, freelancers and agencies adapting a Bootstrap 6 template. It shows which effects to remove or shorten, which ones Bootstrap already handles, and how to check both settings before you ship.

Key Takeaways

  • Bootstrap 6 Alpha 1 already gates Collapse and carousel slide travel on the preference. Your own CSS, hover helpers like .hover-lift, smooth scrolling and scroll libraries are where the real work is.
  • Carousel autoplay is a separate problem from slide animation: data-bs-autoplay="true" still rotates under reduce, so leave it off by default.
  • Write a static, usable baseline first and add motion inside no-preference. Do not paste a universal animation: none !important rule.
  • WCAG 2.2 treats interaction motion (AAA), pausing auto-moving content (A) and flashing (A) as three different rules, and W3C technique C39 uses the query for the first.
  • Test with DevTools or Playwright emulation, then once more with the real OS setting, including a switch while the page is open.

Which motion should you audit first?

Audit the effects that move content across the screen or start by themselves first: carousel rotation, scroll reveals, parallax and smooth scrolling. Hover feedback and loading states come after.

Before touching anything, find out what you actually have. Open the template’s CSS and JS and check the Bootstrap version in them. Canvas 8.1.0 moved from Bootstrap 5.3.8 to 6.0.0-alpha.1 (Canvas 8.1.0 release notes), and Bootstrap’s own version index lists 6.0.0-alpha.2 as the latest Bootstrap 6 prerelease with 5.3.9 as the current stable release (Bootstrap versions). Guides written for Bootstrap 5 mention .collapsing, .collapsed and data-bs-ride, and none of those are how Alpha 1 works.

Then check the Sass options if you compile your own build. Alpha 1 defaults are $enable-transitions: true, $enable-reduced-motion: true and $enable-smooth-scroll: false, and a template’s custom build can override any of them (Bootstrap options). Use this table as the audit sheet.

Effect Who owns it Remove or shorten Keep
Collapse (for example, a FAQ or mobile menu using the plugin) Bootstrap Nothing, Alpha 1 makes the size change immediate under reduce Button, aria-expanded, events
Carousel slide travel and fade Bootstrap Nothing, slides jump and fades swap under reduce Prev/next buttons, keyboard
Carousel autoplay Your config Leave it off, or require a visible play/pause button Manual control
Smooth anchor scrolling Template CSS or JS Smooth only inside no-preference The jump to the target
Parallax, scroll reveals Template JS, GSAP Skip the animation, show content in baseline CSS The content itself
Hover lift, button feedback Bootstrap helper or template CSS The position change Colour, shadow, focus ring

The table gives you the order of work: your own code first, Bootstrap’s defaults last.

One place where I think people over-correct: the preference asks for minimal non-essential motion (MDN). A spinner that tells someone their payment is processing is feedback, so keep the label and drop the spinning if it bothers you, but do not delete the signal.

Which Bootstrap transitions already respect the preference?

In Bootstrap 6 Alpha 1, Collapse and the carousel fade declare their CSS transitions only under no-preference. The carousel also skips its scripted slide travel under reduce.

That covers the question “does Bootstrap Collapse respect the motion preference?”. The Alpha 1 CSS declares the size transition only under no-preference, with a default of 0.35s and ease (tagged CSS). Animating the size requires browser support for interpolate-size (Collapse docs). The plugin checks computed transition duration, so with no duration it does not wait. It still returns promises from show(), hide() and toggle() and still fires shown.bs.collapse and hidden.bs.collapse (Collapse methods). Your code that waits on those Bootstrap events keeps working.

Here is a minimal stock Collapse. The button needs a matching data-bs-target, aria-controls and an initial aria-expanded that agrees with the panel, and the plugin keeps that attribute updated (Collapse accessibility).

<button type="button" class="btn-solid theme-primary"
        data-bs-toggle="collapse" data-bs-target="#shipping-details"
        aria-expanded="false" aria-controls="shipping-details">
  Shipping details
</button>
<div id="shipping-details" class="collapse">
  <p>Delivery options appear at checkout.</p>
</div>

Now the gaps. Alpha 1’s .hover-lift gates its transition on no-preference but still applies the transform on hover and keyboard focus in both modes, with --bs-hover-lift-transform defaulting to translateY(-0.25rem) (tagged CSS). So the card no longer glides, but it still jumps up. If you consider that a spatial effect worth removing, override the token on your own class:

@media (prefers-reduced-motion: reduce) {
  .project-card.hover-lift {
    --bs-hover-lift-transform: none;
  }
}

Colour changes, shadows and focus outlines stay. Put overrides like this in a separate stylesheet so they survive template updates, which is the idea behind keeping template customisations safe across version updates.

If you were thinking of disabling Bootstrap transitions for reduced motion with one blanket rule, don’t. A rule like * { animation: none !important; transition: none !important; } erases feedback you wanted to keep and can break code that waits on animation events. Scope changes to the effects you identified in the audit. And when you borrow a fix from the live Bootstrap docs, compare it against the tagged Alpha 1 CSS: the live Collapse page shows .collapse-instant, which is absent from the Alpha 1 compiled CSS, and data-bs-hash arrived in Alpha 2 (Alpha 2 announcement).

Let it slide or fade, since Bootstrap 6 Alpha 1 skips that travel under reduce, but do not let it rotate on its own unless you add a visible play/pause control.

These are two separate settings and people mix them up. Alpha 1’s sliding carousel uses CSS scroll snap on .carousel-inner. Programmed travel runs in JavaScript, normally takes 300 ms and jumps immediately under reduce. The optional .carousel-fade crossfade (default --bs-carousel-fade-duration: 0.6s) runs only under no-preference (carousel docs). So for the question of how prefers-reduced-motion affects Bootstrap carousel animation, the answer is that the movement is handled for you.

Autoplay is JavaScript and it is not handled. Alpha 1 defaults to autoplay: false with interval: 5000, but data-bs-autoplay="true" starts rotation on load even under reduce (autoplay docs). The old data-bs-ride="carousel" is gone: Alpha 1 replaced ride with the boolean autoplay (Alpha 1 announcement). If you are migrating, our Bootstrap 5 carousel guide still shows the old attribute, so look for it before you copy anything.

A manual carousel with a fade looks like this:

<section id="project-gallery" class="carousel slide carousel-fade"
         aria-label="Project gallery" aria-roledescription="carousel">
  <div>
    <button type="button" data-bs-target="#project-gallery" data-bs-slide="prev">
      Previous project
    </button>
    <button type="button" data-bs-target="#project-gallery" data-bs-slide="next">
      Next project
    </button>
  </div>
  <div class="carousel-inner">
    <div class="carousel-item active" role="group"
         aria-roledescription="slide" aria-label="1 of 2">Project A</div>
    <div class="carousel-item" role="group"
         aria-roledescription="slide" aria-label="2 of 2">Project B</div>
  </div>
</section>

Pick your approach like this:

  • Pick manual only if the slides carry content people need, like testimonials, pricing tiers or case studies. This is the safe default and my own recommendation.
  • Pick autoplay with a control if the design really needs rotation. Add a .carousel-control-play-pause button with a matching data-bs-target and labels through data-bs-play-label and data-bs-pause-label, then follow the WAI carousel pattern: stop rotation when focus enters and restart only on explicit request. In Alpha 1, you need to handle that focus behavior yourself (tagged carousel.ts).

Do not try to fix autoplay by calling pause() when the query matches. In Alpha 1, pause() clears the timer but the internal autoplay intent can stay set, so rotation can come back after a hover (tagged carousel.ts). Not enabling autoplay in the first place is simpler. For more on sliders in templates see our testimonial slider guide, but apply the Bootstrap 6 settings above.

How do you turn off smooth scrolling, parallax and reveals?

Make smooth scrolling, parallax and decorative reveals opt-in under (prefers-reduced-motion: no-preference), and write the default CSS so everything is already visible and in place.

Diagram: baseline CSS for everyone, with smooth scroll and reveals added only under no-preference
Write the static baseline first, then add motion inside the no-preference query

W3C technique C39 shows two approaches: suppress motion under reduce or use static defaults with motion gated on no-preference (C39). I prefer the second, because if the query fails or JavaScript never loads, the visitor still gets the content. For the question of which query to use for scroll animation in Bootstrap, this is it. For native anchor links:

html,
.template-scroll-region {
  scroll-behavior: auto;
}

@media (prefers-reduced-motion: no-preference) {
  html,
  .template-scroll-region {
    scroll-behavior: smooth;
  }
}

scroll-behavior: auto scrolls immediately. For viewport scrolling you set it on the root element, and a nested scroller needs its own rule (MDN scroll-behavior), which is why the selector list includes a custom region class. Rename it to whatever your template uses.

If a script scrolls for you, choose the behavior at the moment of the call so a changed preference is picked up. behavior: 'instant' jumps directly (MDN scrollIntoView).

const allowMotion = window.matchMedia('(prefers-reduced-motion: no-preference)');

function scrollToSection(section) {
  section.scrollIntoView({
    behavior: allowMotion.matches ? 'smooth' : 'instant',
    block: 'start',
  });
}

The MediaQueryList gives you .matches for the current state, and you can subscribe with addEventListener('change', handler) if something running needs cleanup when the preference flips (MDN change event).

If your template uses GSAP for scroll reveals, gsap.matchMedia() (added in GSAP 3.11.0) reverts animations and ScrollTriggers created inside its callback when the query stops matching (GSAP docs). With GSAP and ScrollTrigger loaded, run this after the target elements exist. Keep the element visible in your baseline CSS and animate a decorative child, never the text or the buttons:

gsap.registerPlugin(ScrollTrigger);

const motion = gsap.matchMedia();
motion.add('(prefers-reduced-motion: no-preference)', () => {
  document.querySelectorAll('.reveal-decoration').forEach((decoration) => {
    gsap.from(decoration, {
      y: 12,
      opacity: 0,
      duration: 0.25,
      scrollTrigger: { trigger: decoration, start: 'top 90%', once: true },
    });
  });
});

ScrollTrigger loads separately from GSAP core and has to be registered, as shown. If you are untangling an existing setup, our post on GSAP ScrollTrigger animations for page sections helps you find the reveal, parallax and scrub timelines, and smooth scroll animations in a Bootstrap template covers the other half. Both were written for Bootstrap 5, so use them to identify effects and check the markup against Bootstrap 6. Then walk the page with your preference set to reduce and look for content that stays invisible. Small hover and button effects are covered in 11 microinteractions for HTML templates, so audit those at the same time.

Videos, GIFs and Lottie files are not covered by any of this CSS. One media query does not stop every animation, timer or scroll library. Each of them has to honor the preference in its own code.

Which WCAG rules apply to motion, autoplay and flashes?

Three different success criteria apply: 2.3.3 for interaction motion (AAA), 2.2.2 for auto-moving content (A) and 2.3.1 for flashing (A). The media query can help with the first. Check the pause and flash requirements separately.

  • SC 2.3.3, Animation from Interactions (AAA): requires a way to disable interaction-triggered motion unless it is essential to functionality or the information conveyed (WCAG 2.2). Technique C39 shows how to meet it for CSS-driven motion.
  • SC 2.2.2, Pause, Stop, Hide (A): requires a way to pause, stop or hide automatically starting movement lasting more than five seconds alongside other content, with an exception for essential activity. For automatically updating information presented alongside other content, it also allows control over update frequency and has no five-second exception (WCAG 2.2). So a 5,000 ms carousel interval does not get you out of it.
  • SC 2.3.1, Three Flashes or Below Threshold (A): limits content to at most three flashes in any one-second period unless below the general flash and red flash thresholds, and applies in both motion modes (WCAG 2.2).

So honoring the query does not make a page conformant, and none of these criteria names the query. A very short duration does not automatically satisfy 2.3.3 either. Treat the media query as your tool and the criteria as the test.

How do you verify reduced motion before shipping?

Compare the page in both settings with browser emulation or Playwright, then repeat once with the real operating system setting, and include a preference switch while the page is open.

Chrome DevTools offers prefers-reduced-motion: reduce in the Rendering panel (Chrome docs). Playwright’s page.emulateMedia({ reducedMotion }), available since v1.12, takes 'reduce', 'no-preference' or null to clear the override (Playwright). This test uses Playwright v1.27 or later. Serve the Collapse and carousel markup and the smooth-scroll CSS above at /motion-demo.html, load the Alpha 1 CSS and ESM bundle, and configure Playwright’s baseURL:

import { test, expect } from '@playwright/test';

test('reduced motion preserves access to template content', async ({ page }) => {
  await page.emulateMedia({ reducedMotion: 'reduce' });
  await page.goto('/motion-demo.html');

  const trigger = page.getByRole('button', { name: 'Shipping details' });
  const panel = page.locator('#shipping-details');
  await trigger.press('Enter');
  await expect(trigger).toHaveAttribute('aria-expanded', 'true');
  await expect(panel).toBeVisible();
  await expect(panel).toHaveCSS('transition-duration', '0s');
  await trigger.press('Enter');
  await expect(trigger).toHaveAttribute('aria-expanded', 'false');
  await expect(panel).toBeHidden();

  const gallery = page.locator('#project-gallery');
  await gallery.getByRole('button', { name: 'Next project' }).press('Enter');
  const activeSlide = gallery.locator('.carousel-item.active');
  await expect(activeSlide).toHaveText('Project B');
  await expect(activeSlide).toHaveCSS('transition-duration', '0s');

  const root = page.locator('html');
  await expect(root).toHaveCSS('scroll-behavior', 'auto');
  await page.emulateMedia({ reducedMotion: 'no-preference' });
  await expect(root).toHaveCSS('scroll-behavior', 'smooth');
});

It checks state and styles, not whether something feels right, so a person still has to look at the effects. This is the checklist to run in both modes:

  1. Load the page fresh with the setting already on. Does any hero, reveal or counter animate?
  2. Flip the setting while the page is open. Do running effects stop or revert?
  3. Use only the keyboard on every Collapse and carousel control. Is the state announced and the focus ring visible?
  4. Check that nothing rotates without a control, and that the control works.
  5. Click each anchor link and confirm the final scroll position and where focus lands.
  6. Scroll through the whole page without waiting for animations. Is every block of text readable?
  7. Look at loading and error states. Is the label still there when the spinner motion is gone?

Run through that list and you have an audit record you can hand to a client.

Your first step this week

Open the template’s compiled CSS and JS, confirm which Bootstrap version it loads, and fill in the audit table from the first section for your own site. If you are on Canvas, the Canvas 8.1 Bootstrap 6 template page lists Alpha 1 as its baseline and the package includes SCSS source, so you can check the options above before overriding anything. Its limit is the same as any template on a prerelease: 8.1.3 is the newest patch in the public changelog, so verify the assets your own download ships instead of assuming it matches Alpha 2.

After that one pass you will know which effects Bootstrap already handles, which ones are yours to fix, and you will have a short list of overrides to write. Then run the Playwright test. Also you need to actually turn the setting on in your own OS and browse your site once.

Frequently Asked Questions

How do I disable Bootstrap transitions for reduced motion?

You usually do not need to: Bootstrap 6 Alpha 1 keeps $enable-reduced-motion: true by default, and its Collapse and carousel fade transitions only run under no-preference. The carousel skips scripted slide travel under reduce. Scope your own overrides to custom effects and helpers like .hover-lift.

Does Bootstrap Collapse respect the motion preference?

Yes in Alpha 1. The size transition is declared only under no-preference, so panels open and close instantly under reduce, while aria-expanded still updates and the shown and hidden events still fire.

Does prefers-reduced-motion stop a Bootstrap carousel animation and autoplay?

It removes the slide travel and the crossfade, but not autoplay. If you set data-bs-autoplay="true" the carousel still rotates under reduce, so leave autoplay off or add a visible play/pause control.

What query should I use for Bootstrap scroll animation?

Use (prefers-reduced-motion: no-preference) around smooth scrolling, parallax and reveals, and keep the default CSS static and visible. In scripts, check window.matchMedia at the time of the action.

How do I test prefers-reduced-motion in an HTML template?

Emulate it in the Chrome DevTools Rendering panel or with Playwright’s emulateMedia, then repeat with the real OS setting. Check a fresh load, a live switch, keyboard controls, carousel rotation and that all content shows without scrolling into a trigger.

Is honoring reduced motion enough for WCAG?

No. Interaction motion (SC 2.3.3) is AAA, while auto-moving content (SC 2.2.2) and flashing (SC 2.3.1) are separate Level A criteria that apply whatever the preference is.

Skip the setup and build it free

Spin up a complete Bootstrap 5 site, blog included, with Canvas Builder. No coding, no cost.

Share:
Rohit S
Rohit S

Rohit S builds Canvas at SemiColonWeb, the team behind the Canvas HTML Template, CanvasWP and CanvasBuilder AI.

More from the Canvas Blog