mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1780015 - Add targeting for users who prefer reduced motion in AboutWelcome message surfaces r=pdahiya
Differential Revision: https://phabricator.services.mozilla.com/D152174
This commit is contained in:
parent
bdc4ade597
commit
98f95b2a3f
@ -55,6 +55,7 @@ Please note that some targeting attributes require stricter controls on the tele
|
||||
* [doesAppNeedPrivatePin](#doesappneedprivatepin)
|
||||
* [isBackgroundTaskMode](#isbackgroundtaskmode)
|
||||
* [backgroundTaskName](#backgroundtaskname)
|
||||
* [userPrefersReducedMotion](#userPrefersReducedMotion)
|
||||
|
||||
## Detailed usage
|
||||
|
||||
@ -843,3 +844,8 @@ Checks if this invocation is running in background task mode.
|
||||
|
||||
A non-empty string task name if this invocation is running in background task
|
||||
mode, or `null` if this invocation is not running in background task mode.
|
||||
|
||||
### `userPrefersReducedMotion`
|
||||
|
||||
Checks if user prefers reduced motion as indicated by the value of a media query for `prefers-reduced-motion`.
|
||||
|
||||
|
@ -741,6 +741,11 @@ const TargetingGetters = {
|
||||
);
|
||||
return bts?.backgroundTaskName();
|
||||
},
|
||||
|
||||
get userPrefersReducedMotion() {
|
||||
let window = lazy.BrowserWindowTracker.getTopWindow();
|
||||
return window?.matchMedia("(prefers-reduced-motion: reduce)")?.matches;
|
||||
},
|
||||
};
|
||||
|
||||
const ASRouterTargeting = {
|
||||
|
@ -1163,3 +1163,11 @@ add_task(async function check_isBackgroundTaskMode() {
|
||||
"Has no background task name"
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function check_userPrefersReducedMotion() {
|
||||
is(
|
||||
typeof (await ASRouterTargeting.Environment.userPrefersReducedMotion),
|
||||
"boolean",
|
||||
"Should return a boolean"
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user