Skip to content

Studio: set scrollbar-color in rgb so Reduce motion stops restarting a transition on every element - #17413

Merged
danielhanchen merged 1 commit into
mainfrom
studio-scrollbar-color-legacy-rgb
Nov 10, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-scrollbar-color-legacy-rgb

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Since #17377 turned Reduce motion on by default, the area matrix in Frontend build + bundle sanity fails on main: in every Glass material, opening the API monitor restyles 3,400 to 4,900 elements against about 110 in the default appearance (limit 10x). Bisecting ec6d1606..c3af42a6 with only that cell measured lands on #17377 (123 elements before it, 13,754 after).

#17377 itself is fine, it only flips a default. It exposed a cost that every user who had turned Reduce motion on was already paying:

  • Reduce motion sets transition-duration: 0.01ms on every element (html.force-reduced-motion *). Elements with no transition of their own keep the initial transition-property: all, so every property change on them now runs a transition.
  • * { scrollbar-color: oklch(0.5 0 0 / 0.54) transparent } puts an oklch colour on every element. Chromium reads it back as oklab(...) once a transition has run on it, so the next restyle of that element sees a different value and starts another scrollbar-color transition, which restyles it again.

A Chrome trace of one API monitor open and close in Liquid Glass shows 10,635 scrollbar-color transitions started, and nearly every restyle reason is Animation. Any restyle of a long thread triggers the same loop, not just the monitor.

Change

  • Every scrollbar-color in index.css and hub.css is now written as the equivalent rgb() (for example oklch(0.5 0 0 / 0.54) becomes rgb(99 99 99 / 0.54)). These are achromatic greys, so the conversion is exact to the nearest 8-bit step and nothing changes on screen. Legacy colours round-trip unchanged, so no spurious transition starts.
  • studio/frontend/tests/scrollbar-color-legacy-rgb.test.ts checks every scrollbar-color under src/ is rgb, hex or a keyword, and rejects oklch, var() and color-mix(). Run against main's index.css, it fails and lists the oklch values.

Measured

Production long-thread build, Chromium, same harness as the area matrix (_area_matrix.Page.sweep), elements restyled per area:

Area Appearance Turns main this PR
type default 200 63 53
type liquid-3d 200 12,980 1,306
thread_scroll default 200 3,878 1,497
thread_scroll liquid-3d 200 19,816 3,706
api_monitor liquid 40 13,779 4,105

CPU for typing in liquid-3d at 200 turns goes from 2.9 s to 0.6 s.

Not fixed here

With Reduce motion on, the API monitor cell is still above the 10x limit in Glass (about 4,000 elements against 110). That remainder does not come from CSS: with this change it stays at 3,400 even when every reduced-motion transition is forced to 0s, and it drops to 117 when Reduce motion is set to Off. It comes from the JS side of Reduce motion and needs its own change.

Testing

  • node --test tests/scrollbar-color-legacy-rgb.test.ts tests/dialog-scrollbar-corners.test.ts pass. The new test fails on main's index.css.
  • The built CSS carries the rgb values (scrollbar-color:#6363638a transparent and so on).

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T14:56:24.347132Z 0a45de3 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 0a45de3942

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant