Skip to content

Studio: modal opens stop re-laying out long chats in WebKit - #17284

Merged
danielhanchen merged 4 commits into
mainfrom
studio-overlay-paint
Nov 9, 2026
Merged

danielhanchen merged 4 commits into
mainfrom
studio-overlay-paint

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

On macOS WebKit, opening or closing a menu or dialog still cost far more in a long chat than in a short one (Round 11 real runners: composer menu about 200 to 250 ms at 150 turns against 72 to 100 ms at 1 turn; Settings 390 to 560 ms against 232 to 306 ms). #16902 and #17006 removed the whole-thread restyles that Radix's body pointer-events lock caused in Chromium; WebKit still paid for the scroll lock.

Cause

Every modal open and close sets or clears body[data-scroll-locked], and WebKit re-ran style and layout over the whole page for it:

  1. hub.css still had body[data-scroll-locked] .hub-modal-pe-guard. A body attribute before a descendant combinator makes WebKit re-check every element under <body>, every message included. Studio: key the modal pointer-lock rules off attributes that never sit above the thread #17006 removed this pattern from index.css, but its test only scanned index.css.
  2. The lock rule flips <body> from overflow: visible; position: static to hidden; relative, which re-lays out the whole long page in WebKit.

WebKit microbenchmark (Playwright WebKit, Mac UA, one lock on and off with a forced style and layout flush, median of 5): 3 ms at 1 turn; 77 to 121 ms at 150 turns on main; 22 to 33 ms with the hub rule removed; 0 ms with the hub rule removed and the body overflow and position preset.

Change

  • hub.css: the body-keyed rule is removed. Every .hub-modal-pe-guard element also carries pointer-events-auto, which Studio: key the modal pointer-lock rules off attributes that never sit above the thread #17006's region-keyed rule already sets to none behind a modal (and the lower-layer rule covers stacked dialogs). Checked in Chromium and WebKit: the guard reads auto at rest, none with Settings open and auto after close, on main and here alike.
  • index.css: @media screen { body { overflow: hidden; position: relative; } }, so the lock changes nothing on <body>. Print keeps document flow. Desktop already sets html.tauri body { overflow: hidden }. No route scrolls the document itself: on main, every route at 1440x900 and 900x560 has the document's scroll height equal to the viewport (pages scroll their own containers).
  • tests/modal-pointer-lock.test.ts now scans every src/**/*.css and fails on data-scroll-locked, aria-hidden or data-aria-hidden before a combinator (it names the hub rule on main). tests/webkit-modal-page-restyle.test.ts pins the screen preset.

Results

Real macos-15 Safari WebKit (two runners, main twice as A/A, arms rotated, 3 cycles each), open / close ms at 150 turns, main / main (A/A) / this PR:

Surface solid Glass
Composer menu open 228 / 246 / 198 314 / 347 / 198
Composer menu close 262 / 304 / 218 309 / 314 / 218
Command palette close 315 / 348 / 290 382 / 396 / 322
Search chats close 352 / 364 / 318 406 / 415 / 333
Model picker open 259 / 310 / 306 300 / 330 / 227
Settings close 364 / 414 / 384 465 / 455 / 388
Settings open 404 / 436 / 404 510 / 618 / 543

Closes improve on almost every surface beyond the A/A spread, and opens do for the composer menu and, with Glass, the model picker and search. Settings and shortcuts opens stay within noise: their cost is mostly the dialog mount. Long chats still cost more than short ones on macOS WebKit (composer menu about 200 ms against 72 to 100 ms at 1 turn); the remaining growth is not from the attribute toggles measured here.

No visible change. Frontend suite 15,326 pass, tsc clean, full long-chat gate passes.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 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-09T21:07:04.107799Z bd192f1 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. Already looking forward to the next diff.

Reviewed commit: f63104ad89

ℹ️ 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".

@NilayYadav

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ddf3a282e

ℹ️ 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".

html, body and #root); print keeps document flow. */
@media screen {
body {
overflow: hidden;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve scrolling for browser authentication pages

In a browser viewport shorter than the authentication form (for example, a landscape phone or a zoomed-in window), this permanently disables the only scroll container for /login and /change-password. Those routes use the plain <main> branch in app/routes/__root.tsx, and their page wrappers have a minimum viewport height rather than a bounded height with internal scrolling; the non-Tauri branch of app/provider.tsx adds no scroll container either. Previously the document could scroll when these forms exceeded the viewport, but now their lower fields and submit buttons are clipped and cannot be reached by wheel or touch scrolling. Limit the preset to the internally scrolling app shell, or provide an explicit viewport-bounded scroller for the authentication routes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b547db4: at a 1280x360 window the login form is 448px tall and the Login button could not be scrolled to here, while the merge base scrolled the document. The login and change-password main is now its own viewport-height scroller, same as the desktop wrappers.

@NilayYadav

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: b547db43d4

ℹ️ 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".

@NilayYadav

Copy link
Copy Markdown
Collaborator

@codex review

1 similar comment
@NilayYadav

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: bd192f103b

ℹ️ 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.

2 participants