Skip to content

Commit 415e04d

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
RPP: respect reduced-motion preferences when animating timeline
If the user has this preference, we will never animate them when updating their position on the timeline. Fixed: 368317251 Change-Id: I4f02ccfc864edee944f101f8d47922cf8c834464 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6162516 Auto-Submit: Jack Franklin <jacktfranklin@chromium.org> Reviewed-by: Andres Olivares <andoli@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Andres Olivares <andoli@chromium.org>
1 parent 8e21bf7 commit 415e04d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

front_end/panels/timeline/TimelineFlameChartView.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,11 @@ export class TimelineFlameChartView extends Common.ObjectWrapper.eventMixin<Even
896896
}
897897

898898
const visibleWindow = event.state.milli.timelineTraceWindow;
899-
const shouldAnimate = Boolean(event.options.shouldAnimate);
899+
900+
// If the user has set a preference for reduced motion, we disable any animations.
901+
const userHasReducedMotionSet = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
902+
const shouldAnimate = Boolean(event.options.shouldAnimate) && !userHasReducedMotionSet;
903+
900904
this.mainFlameChart.setWindowTimes(visibleWindow.min, visibleWindow.max, shouldAnimate);
901905
this.networkDataProvider.setWindowTimes(visibleWindow.min, visibleWindow.max);
902906
this.networkFlameChart.setWindowTimes(visibleWindow.min, visibleWindow.max, shouldAnimate);

0 commit comments

Comments
 (0)