From 2a534ab1b3e96beadf1bcf83bfca20122680477e Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 18 Nov 2026 01:56:39 +0100 Subject: [PATCH] perf: the shimmer on running status text keeps the browser busy every frame (#34625) The light sweep across a running tool call or status label was a gradient inside the text, which the browser can only animate by redrawing the page on the main thread 60 times a second, so a chat that just waits on a tool call keeps about a tenth of a CPU core busy. The sweep is now a band that moves over the text and brightens it, which the browser animates on the GPU without touching the page. It keeps the same angle, width, colours and timing, so in Chrome the text looks the same as before in light and dark mode and on grey surfaces (the old dark-mode colours never applied, their rule was not valid CSS). Icons in a shimmering row, like the spinner and the chevron, now catch the sweep too, accessibility mode still shows flat text, and a browser without backdrop filter support shows the plain grey label without the sweep. Measured in Chrome with its performance counters over 10 seconds of an idle chat holding a long answer and one running tool call: | | Main thread busy | |---|---| | Before | ~1070 to 1140 ms | | After | ~8 to 113 ms | --- src/app.css | 54 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/src/app.css b/src/app.css index b7ee23bab8..4373b33288 100644 --- a/src/app.css +++ b/src/app.css @@ -218,45 +218,33 @@ select { @keyframes shimmer { 0% { - background-position: 100% 0; + transform: translateX(-50%); } 100% { - background-position: -100% 0; + transform: translateX(50%); } } .shimmer { - background: linear-gradient( - 110deg, - #b4b4b4 0%, - #b4b4b4 43%, - #e8e8e8 50%, - #b4b4b4 57%, - #b4b4b4 100% - ); - background-size: 200% 100%; - background-clip: text; - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - animation: shimmer 1.5s cubic-bezier(0.7, 0, 1, 0.4) infinite; + position: relative; + overflow: hidden; + clip-path: inset(0); + -webkit-text-fill-color: #b4b4b4; color: #b4b4b4; } -:global(.dark) .shimmer { - background: linear-gradient( - 110deg, - #9a9a9a 0%, - #9a9a9a 43%, - #5e5e5e 50%, - #9a9a9a 57%, - #9a9a9a 100% - ); - background-size: 200% 100%; - background-clip: text; - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; +/* Brightens #b4b4b4 text to #e8e8e8. */ +.shimmer::after { + content: ''; + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 200%; + pointer-events: none; + backdrop-filter: brightness(1.256) contrast(1.06); + mask-image: linear-gradient(110deg, transparent 43%, #000 50%, transparent 57%); animation: shimmer 1.5s cubic-bezier(0.7, 0, 1, 0.4) infinite; - color: #9a9a9a; } @keyframes smoothFadeIn { @@ -1117,14 +1105,16 @@ html.high-contrast:not(.dark) .ai-autocompletion::after { color: var(--color-gray-700); } -/* The shimmer gradient is 2.10:1 in light, and clipping it to the text leaves no - solid colour to raise; render it as flat text instead. */ +/* The shimmer text is 2.10:1 in light; render it as flat text instead. */ html.high-contrast:not(.dark) .shimmer { - background: none; color: var(--color-gray-800); -webkit-text-fill-color: var(--color-gray-800); } +html.high-contrast:not(.dark) .shimmer::after { + display: none; +} + /* Shared by file previews and the attachment modal. */ .office-preview { font-size: 0.875rem;