From eb078a0a19aed6ea14f7323b82f878ec3521f078 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Thu, 26 Nov 2026 04:06:58 +0800 Subject: [PATCH] fix(appearance): give reduced-motion transitions no duration so layout reads stay right (#5961) Reduce motion set every element's transition-duration to 0.01ms. With the default transition-property: all, every property change on every element became a transition, CodeMirror's virtual height gaps included, so a layout read right after a change saw the old size and diff navigation scrolled to the end of the file instead of centring the change. Transitions now get 0s; animations keep 0.01ms so their end events still fire. --- src/styles/global.css | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/styles/global.css b/src/styles/global.css index d254f07c3b..772b20a8b5 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -22,14 +22,16 @@ /* Appearance › Reduce motion, or the system's reduced-motion preference: animations jump to their end state and transitions apply at once, so spinners stand still and popups appear without a - fade. Animation events still fire. */ + fade. Animation events still fire. Transitions get no duration at all: with the default + `transition-property: all`, any non-zero one would make every element, CodeMirror's height + gaps included, report its old size for a frame after a change and throw off layout reads. */ :root[data-reduce-motion] *, :root[data-reduce-motion] *::before, :root[data-reduce-motion] *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; - transition-duration: 0.01ms !important; + transition-duration: 0s !important; transition-delay: 0s !important; scroll-behavior: auto !important; } @@ -41,7 +43,7 @@ animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; - transition-duration: 0.01ms !important; + transition-duration: 0s !important; transition-delay: 0s !important; scroll-behavior: auto !important; }