Skip to content

Commit

Permalink
Honor prefers-reduced-motion user preference #9894
Browse files Browse the repository at this point in the history
Makes it so that we disable all animations if the user prefers reduced
motion. Because there might be up to 7.4% of users who are impacted by
"motion sickness":

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4069154/#:~:text=The%20study%20found%20lifetime%20adult,preponderance%20%5B27%2C29%5D.
  • Loading branch information
PowerKiKi committed Oct 11, 2024
1 parent 1f3c8e9 commit 2572cc0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ const iconsConfig: NaturalIconsConfig = {
},
};

const prefersReducedMotion = typeof matchMedia === 'function' ? matchMedia('(prefers-reduced-motion)').matches : false;

bootstrapApplication(AppComponent, {
providers: [
provideZoneChangeDetection({eventCoalescing: true}),
Expand All @@ -97,7 +99,7 @@ bootstrapApplication(AppComponent, {
),
Apollo,
provideNativeDateAdapter(),
provideAnimationsAsync(),
provideAnimationsAsync(prefersReducedMotion ? 'noop' : 'animations'),
naturalProviders,
provideErrorHandler(localConfig.log.url, LoggerExtraService),
provideSeo({
Expand Down

0 comments on commit 2572cc0

Please sign in to comment.