Bug 1642323 - Make alert.js obey prefers-reduced-motion. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D78032
This commit is contained in:
Dão Gottwald 2020-06-04 11:18:07 +00:00
Родитель 7875f1e34e
Коммит 56cbbca35b
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -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([
{

Просмотреть файл

@ -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);