diff --git a/browser/base/content/test/alerts/head.js b/browser/base/content/test/alerts/head.js index bb5d5f1f6063..2c2e04f98d94 100644 --- a/browser/base/content/test/alerts/head.js +++ b/browser/base/content/test/alerts/head.js @@ -1,3 +1,9 @@ +// Platforms may default to reducing motion. We override this to ensure the +// alert slide animation is enabled in tests. +SpecialPowers.pushPrefEnv({ + set: [["ui.prefersReducedMotion", 0]], +}); + async function addNotificationPermission(originString) { return SpecialPowers.pushPermissions([ { diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js index 79e2fecf4131..71924d645963 100644 --- a/toolkit/components/alerts/resources/content/alert.js +++ b/toolkit/components/alerts/resources/content/alert.js @@ -211,9 +211,7 @@ function onAlertLoad() { // If the require interaction flag is set, prevent auto-closing the notification. if (!gRequireInteraction) { - if ( - !Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled", true) - ) { + if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) { setTimeout(function() { window.close(); }, ALERT_DURATION_IMMEDIATE);