Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): programmatic scrolls jump instead of glide when Reduce Motion is on #16014

Mergedsaphid(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/16014/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 66 additions and 15 deletions (loading 2).

x
0 of 5 viewed, 5 left
1 addition and 1 deletionapps/web/src/components/chat/MessagesTimeline.tsxModified
View file
@@ -1510,7 +1510,7 @@
onManualNavigation();
void listRef.current?.scrollToIndex({
index: item.rowIndex,
- animated: true,
+ animated: !window.matchMedia("(prefers-reduced-motion: reduce)").matches,
viewOffset: 24,
56 additions and 12 deletionsapps/web/src/components/chat/pageScrollController.test.tsModified
View file
@@ -17,6 +17,8 @@
private animationFrames = new Map<number, FrameRequestCallback>();
private timeouts = new Map<number, { at: number; callback: () => void }>();
​
+ reducedMotion = false;
+​
readonly env = {
now: () => this.currentTime,
requestAnimationFrame: (callback: FrameRequestCallback) => {
@@ -37,6 +39,7 @@
clearTimeout: (handle: number) => {
this.timeouts.delete(handle);
},
+ prefersReducedMotion: () => this.reducedMotion,
};
​