diff --git a/.changeset/y_reduced_motion_option.md b/.changeset/y_reduced_motion_option.md
new file mode 100644
index 00000000..4cec37f5
--- /dev/null
+++ b/.changeset/y_reduced_motion_option.md
@@ -0,0 +1,5 @@
+---
+sable: minor
+---
+
+Added reduced motion setting. Let us know if any elements were missed!
diff --git a/src/app/features/room/RoomTimeline.tsx b/src/app/features/room/RoomTimeline.tsx
index 38063d24..7cb5a9e1 100644
--- a/src/app/features/room/RoomTimeline.tsx
+++ b/src/app/features/room/RoomTimeline.tsx
@@ -571,6 +571,7 @@ export function RoomTimeline({
const showUrlPreview = room.hasEncryptionStateEvent() ? encUrlPreview : urlPreview;
const [showHiddenEvents] = useSetting(settingsAtom, 'showHiddenEvents');
const [showDeveloperTools] = useSetting(settingsAtom, 'developerTools');
+ const [reducedMotion] = useSetting(settingsAtom, 'reducedMotion');
const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock');
const [dateFormatString] = useSetting(settingsAtom, 'dateFormatString');
@@ -814,7 +815,7 @@ export function RoomTimeline({
if (typeof absoluteIndex === 'number') {
const scrolled = scrollToItem(absoluteIndex, {
- behavior: 'smooth',
+ behavior: reducedMotion ? 'instant' : 'smooth',
align: 'center',
stopInView: true,
});
@@ -828,7 +829,7 @@ export function RoomTimeline({
loadEventTimeline(evtId);
}
},
- [room, timeline, scrollToItem, loadEventTimeline]
+ [room, timeline, scrollToItem, loadEventTimeline, reducedMotion]
);
useLiveTimelineRefresh(
@@ -1067,7 +1068,7 @@ export function RoomTimeline({
if (scrollToBottomCount > 0) {
const scrollEl = scrollRef.current;
if (scrollEl) {
- const behavior = scrollToBottomRef.current.smooth ? 'smooth' : 'instant';
+ const behavior = scrollToBottomRef.current.smooth && !reducedMotion ? 'smooth' : 'instant';
scrollToBottom(scrollEl, behavior);
// On Android WebView, layout may still settle after the initial scroll.
// Fire a second instant scroll after a short delay to guarantee we
@@ -1078,7 +1079,7 @@ export function RoomTimeline({
}
}
}
- }, [scrollToBottomCount]);
+ }, [scrollToBottomCount, reducedMotion]);
// Remove unreadInfo on mark as read
useEffect(() => {
diff --git a/src/app/features/settings/cosmetics/Themes.tsx b/src/app/features/settings/cosmetics/Themes.tsx
index 6203ad8b..043b0f0f 100644
--- a/src/app/features/settings/cosmetics/Themes.tsx
+++ b/src/app/features/settings/cosmetics/Themes.tsx
@@ -246,6 +246,7 @@ function ThemeSettings() {
const [systemTheme, setSystemTheme] = useSetting(settingsAtom, 'useSystemTheme');
const [saturation, setSaturation] = useSetting(settingsAtom, 'saturationLevel');
const [underlineLinks, setUnderlineLinks] = useSetting(settingsAtom, 'underlineLinks');
+ const [reducedMotion, setReducedMotion] = useSetting(settingsAtom, 'reducedMotion');
return (
@@ -305,6 +306,13 @@ function ThemeSettings() {
after={}
/>
+
+ }
+ />
+
);
}
diff --git a/src/app/pages/ThemeManager.tsx b/src/app/pages/ThemeManager.tsx
index 2b335012..90a7e578 100644
--- a/src/app/pages/ThemeManager.tsx
+++ b/src/app/pages/ThemeManager.tsx
@@ -32,6 +32,7 @@ export function AuthRouteThemeManager({ children }: { children: ReactNode }) {
const activeTheme = useActiveTheme();
const [saturation] = useSetting(settingsAtom, 'saturationLevel');
const [underlineLinks] = useSetting(settingsAtom, 'underlineLinks');
+ const [reducedMotion] = useSetting(settingsAtom, 'reducedMotion');
useEffect(() => {
document.body.className = '';
@@ -44,6 +45,12 @@ export function AuthRouteThemeManager({ children }: { children: ReactNode }) {
document.body.classList.remove('force-underline-links');
}
+ if (reducedMotion) {
+ document.body.classList.add('reduced-motion');
+ } else {
+ document.body.classList.remove('reduced-motion');
+ }
+
if (saturation === 0) {
document.body.style.filter = 'grayscale(1)';
} else if (saturation && saturation < 100) {
@@ -51,7 +58,7 @@ export function AuthRouteThemeManager({ children }: { children: ReactNode }) {
} else {
document.body.style.filter = '';
}
- }, [activeTheme, saturation, underlineLinks]);
+ }, [activeTheme, saturation, underlineLinks, reducedMotion]);
return {children};
}
diff --git a/src/app/state/settings.ts b/src/app/state/settings.ts
index 5daaad09..88f9c908 100644
--- a/src/app/state/settings.ts
+++ b/src/app/state/settings.ts
@@ -81,6 +81,7 @@ export interface Settings {
hideReads: boolean;
emojiSuggestThreshold: number;
underlineLinks: boolean;
+ reducedMotion: boolean;
// furry stuff
renderAnimals: boolean;
@@ -151,6 +152,7 @@ const defaultSettings: Settings = {
hideReads: false,
emojiSuggestThreshold: 2,
underlineLinks: false,
+ reducedMotion: false,
// furry stuff
renderAnimals: true,
diff --git a/src/index.css b/src/index.css
index cebe1da7..b0edbc4f 100755
--- a/src/index.css
+++ b/src/index.css
@@ -175,8 +175,49 @@ pre {
font-variant-ligatures: contextual;
}
+/* Accessibility Overrides :D */
+
.force-underline-links a {
text-decoration: underline !important;
text-decoration-thickness: 1px;
text-underline-offset: 2px;
}
+
+body.reduced-motion * {
+ animation-duration: 0.001ms !important;
+ transition-duration: 0.001ms !important;
+}
+
+body.reduced-motion button:hover,
+body.reduced-motion a:hover,
+body.reduced-motion [role='button']:hover {
+ transform: none !important;
+ scale: 1 !important;
+}
+
+body.reduced-motion div[class*='Sidebar_SidebarItem']:hover,
+body.reduced-motion div[class*='Sidebar_SidebarItem']:hover button,
+body.reduced-motion div[class*='Sidebar_SidebarItem']:hover img {
+ transform: none !important;
+ scale: 1 !important;
+ translate: none !important;
+ margin: 0 !important;
+ padding: 0 !important;
+}
+
+body.reduced-motion div[class*='Sidebar_SidebarStack']:hover {
+ width: revert !important;
+ translate: none !important;
+ transform: none !important;
+}
+
+body.reduced-motion div[class*='layout_MessageBase'] {
+ animation: none !important;
+ transition: none !important;
+ transform: none !important;
+}
+
+body.reduced-motion div[class*='RoomTimeline_messageList'],
+body.reduced-motion div[class*='RoomTimeline_messageList'] > * {
+ scroll-behavior: auto !important;
+}