Файли
openidea/src/platform/motion.ts
T
l0ng-ai baa0171d8a feat(appearance): add a Reduce motion setting (#5940)
Adds Reduce motion under Appearance > Accessibility. When on, or when the system asks for reduced motion, CSS animations and transitions finish at once; script-driven motion reads the same preference.

Fixes #5887
2026-11-26 01:42:42 +08:00

10 рядки
528 B
TypeScript
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
/**
* Whether motion should be reduced: Settings › Appearance › Reduce motion (the `data-reduce-motion`
* root attribute) or the system's reduced-motion preference. For script-driven animation; CSS
* reads the attribute and the media query itself.
*/
export function reducedMotion(): boolean {
if (typeof document !== "undefined" && document.documentElement.dataset.reduceMotion !== undefined) return true;
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
}