Repository navigation
Description
The sidebar menus a user actually opens are still on the body modal layer, and one of them is the most expensive menu measured anywhere in this work.
#9051 takes the chat menus off modal={false}, which removes a pointer-events: none on <body> that invalidates computed style for the whole thread subtree. Measured there, the cost of opening a menu stops scaling with thread size: 419 ms at 25K chars and 3570 ms at 300K becomes 52 ms at both, with style recalculation going from 3140 of 3570 ms to 3.3 ms.
That fix does not reach the sidebar.
The measurement
Packaged production build, same 220-message thread, same run, so the only difference between the two rows is modality:
| menu | time to open and close |
|---|---|
| More menu (patched by #9051) | 38.6 ms |
| "Chat options" (still modal) | 382.6 ms |
9.9x.
The three sites
None is touched by #9051 and all three are still modal on the packaged head build:
studio/frontend/src/components/app-sidebar.tsx:2234("Organize chats")studio/frontend/src/components/app-sidebar.tsx:2578("Chat options")studio/frontend/src/features/chat/chat-page.tsx:1666
Worth noting why this was missed: #9051 does convert two sidebar menus, but they live in features/chat/thread-sidebar.tsx, which nothing imports. No file under src/ references it, and the string "Export all chats" appears in 0 of 513 built JS assets, so vite tree-shakes it out. Those two menus never mount. The live sidebar menus are the three above.
Why this was not folded into #9051
The dismissal guard is mounted inside each menu's content rather than globally, so modal={false} alone is not the whole change: each converted menu also needs <MenuDismissGuard /> in its content and its own pass through the 16-case dismissal matrix.
That matrix is not optional here. Every data-loss defect found in review on #9051 lived in exactly that gap: a dismissing press landing on the control underneath and deleting a message. Cases like a held press plus Enter, a held press plus Space, and dismissing then pressing Space were each real and each needed a separate fix. Converting three more menus at the end of that review without re-running it is the one change that should not be made at that point.
What this needs
For each of the three sites: set the menu non-modal, mount the guard inside its content, then run tests/studio/probe_dismiss_guard.py against it on chromium, firefox and webkit, and confirm the "swallowed too much" cases as well as the "swallowed too little" ones. Then re-measure the open and close cost on a packaged build to confirm the 382.6 ms figure moves.
Also worth checking as part of the same pass: 31 DropdownMenu roots remain modal overall, so this issue should establish whether the sidebar three are the only ones on a hot path or merely the ones measured so far.
Activity
danielhanchen commentedon Sep 9, 2026
Closing. The sidebar header menu, the chat row menu and the chat page menu are all on the non modal wrapper with the dismiss guard now.