Skip to content

Studio: take the three live sidebar menus off the body modal layer - #9229

Closed
danielhanchen wants to merge 1 commit into
perf-radix-modalfrom
perf-sidebar-nonmodal
Closed

danielhanchen wants to merge 1 commit into
perf-radix-modalfrom
perf-sidebar-nonmodal

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #9051, and the fix for #9168.

#9051 takes the chat menus off the body modal layer and measures a large win, but it does not
reach the sidebar. The three menus a user actually opens were still modal, and one of them is
the most expensive menu measured anywhere in this work: on one packaged production build,
same 220-message thread, same run, the action-bar More menu patched by #9051 opens and closes
in 38.6 ms and the sidebar's "Chat options" menu, identical interaction, in 382.6 ms.

This converts the three, with the guard, and measures each one.

The change

Three <DropdownMenu> roots get modal={false}, and each one mounts <MenuDismissGuard />
first in its content:

site menu
app-sidebar.tsx renderSidebarHeaderMenu the list-header "..." -- Organize chats, Organize projects, Sort pinned chats, all three from one function
app-sidebar.tsx per-thread trigger "Chat options", the one opened constantly in ordinary use
chat-page.tsx project page row "Chat options" on a project's chat list

Six lines of source, plus studio/frontend/tests/sidebar-menu-modality.test.ts.

This PR is stacked on #9051 and targets its branch. The guard lives in
src/lib/menu-dismiss.ts and src/lib/menu-dismiss-guard.tsx, which exist only there, and it
is mounted PER MENU rather than globally, so modal={false} on its own is not the whole
change for these three. Merge #9051 first; GitHub will retarget this to main.

Why the modal layer costs anything

A modal Radix layer parks pointer-events: none on <body> for as long as it is open
(@radix-ui/react-dismissable-layer). pointer-events is INHERITED, so that single write
invalidates computed style for the entire mounted subtree, which on a chat page is the thread.
The cost of opening a menu therefore scales with the thread rather than with the menu.
modal={false} is the upstream answer to exactly this (radix-ui/primitives discussions #2873
and #1720, shadcn-ui/ui #6908).

Read directly off the page, while each menu is open, on all three menus and all three engines:

base this branch
document.body.style.pointerEvents none ""
computed pointer-events on body none auto
data-scroll-locked on body present absent
aria-hidden body children 3 1

Measurement

Every number in this section is off a PRODUCTION bundle. There is no vite dev server
anywhere in this PR's timings.
Both arms are vite build output with distinct
assets/index-*.js hashes, served as static dists. That is worth stating outright, because a
dev server does not merely scale timings: React's development-only paths cost in proportion to
elements created per frame, so the bias is correlated with a treatment that changes how much
subtree work is mounted, and it does not cancel in a base/head ratio. Taking menus off the
Radix modal layer is exactly such a treatment, so a dev-server measurement here would not have
been salvageable by ratioing.

Two Studios on ONE backend, differing only in the frontend bundle they serve
(unsloth studio --frontend <dist>), one dist built from #9051's head and one from this
branch. Each side has its own UNSLOTH_STUDIO_HOME and its own port, and each was checked to
be serving its own assets/index-*.js before anything was timed. Identical seeded content on
both: a project, a 220-message plain thread and a 220-message markdown thread (187,118 chars).
One shared backend is deliberate: the diff is three frontend files, so holding the backend
fixed removes it as a variable rather than duplicating it.

One press to open, Escape to close, timed from before the press to after the last [role=menu]
has gone. Each trial times BOTH sides back to back and the arm order alternates by trial, so
the second half is the reversed-order repeat and a drift on this shared box cannot favour
either arm. The paired ratio is the result; absolute milliseconds are context. A trial is
rejected outright unless both arms mounted the same amount of the page, since the cost being
removed scales with the mounted subtree.

Medians of 3 paired trials:

engine menu thread base head ratio change
chromium sidebar Organize chats markdown, 12,024 nodes 508.1 ms 170.7 ms 0.336 -66.4%
chromium sidebar Chat options markdown, 12,024 nodes 522.1 ms 175.2 ms 0.336 -66.4%
chromium project page Chat options project page, 686 nodes 191.1 ms 174.3 ms 0.912 -8.8%
firefox sidebar Organize chats markdown, 12,024 nodes 938 ms 160 ms 0.166 -83.4%
firefox sidebar Chat options markdown, 12,024 nodes 893 ms 172 ms 0.193 -80.7%
firefox project page Chat options project page, 704 nodes 214 ms 173 ms 0.805 -19.5%
webkit sidebar Organize chats markdown, 12,024 nodes 1592 ms 197 ms 0.123 -87.7%
webkit sidebar Chat options markdown, 12,024 nodes 1435 ms 217 ms 0.158 -84.2%
webkit project page Chat options project page, 686 nodes 252 ms 162 ms 0.644 -35.6%

Repeated on a plain-text thread of the same 220 messages, which mounts 2,343 nodes rather than
12,024, every cell still improves and every cell improves by less: chromium -25.6% / -28.0% /
-16.8%, firefox -59.0% / -47.4% / -25.6%, webkit -63.7% / -64.2% / -36.4%. That is the point.
The head arm is flat at about 170 ms across both thread weights on all three engines; only
the base arm grows.
18 cells, all 18 faster, and the per-trial ratios inside each cell agree
to within a few points.

The project page number is small on purpose and should not be read as a disappointment: that
route has no thread mounted, so there is little style to invalidate. It is the same defect,
costing less, and it costs nothing to remove.

What was checked, per menu

Full matrix, three engines, three arms (base, this branch, and a guardless mutant), three
repeats per case, driven with page.mouse and page.touchscreen so every press is a real hit
test that honours pointer-events.

Two runs were thrown away rather than reconciled.

Five unrelated static servers on this box were killed at 21:27 UTC, and the firefox matrix was
mid-run on its head arm at that moment, so it was discarded and re-run clean. The re-run
reproduces the discarded one cell for cell, across all 3 arms x 3 menus x 25 checks, so
the contamination in fact changed nothing; it was discarded and re-run anyway rather than
reconciled after the fact. The chromium cells were re-run for a different and better reason:
they were written at 20:49:12 by a menu3_matrix.py that was edited at 20:55:54, so those
numbers came from a harness version that no longer exists, and nothing in the results
themselves would have revealed it.

No timing trial was affected either way. Every number in the Measurement section was
written between 20:04 and 20:17 UTC, over an hour before the kill, and those three Studios
stayed up throughout with unbroken request logs across 21:27.

On this branch, on all three menus:

  • mouse open: 3/3, and the menu that opens has the same item count as base (5, 8 and 7)
  • selecting an item reaches the item's handler and takes effect: 3/3
  • a press outside dismisses it: 3/3
  • ...and does NOT fire the control underneath: 3/3
  • ...and the NEXT press on that same element DOES fire: 3/3, so the guard eats exactly one
    click and nothing became click-blocked
  • a HELD press (700 ms) on an adjacent chat row dismisses without navigating: 3/3 on the two
    "Chat options" menus; on the list-header menu the press does not dismiss at all, see below
  • dismiss-then-Space does not activate the row the swallowed press focused: 3/3
  • keyboard: trigger focusable, Enter opens, ArrowDown moves, Escape closes: 3/3
  • touch open: 3/3, and the tap does not fire what is underneath: 3/3. Touch dismiss is 3/3
    everywhere except one cell, called out below

Touch was run on all three engines, not just chromium and webkit: Playwright's hasTouch
dispatches real touch events on firefox as well, and these are real firefox measurements.

Where this evidence is weaker than the table above looks

Three things cut against the result and are stated here rather than left in a footnote,
because each one would otherwise quietly inflate it.

1. The kill control kills on two of the three menus, not three. On the list-header
"Organize chats" menu, the guardless mutant scores 3/3 on held_dismiss_did_not_navigate,
quick_dismiss_did_not_navigate and dismiss_then_space_did_not_navigate -- the same as
head. It is not that the guard is doing its job there; it is that the harness's press never
dismisses that menu on any tree, so there is no swallowed click for the guard to be credited
with. A kill control that does not kill on a third of the surface is a weaker control than it
first appears, and the list-header menu's protection rests on the other checks
(underlying_swallowed, neutral_click_after, touch_underlying_swallowed, the double-click
counter) rather than on these three.

2. The base arm's underlying_swallowed is not measured against the same element as head's,
and cannot be.
On base, body { pointer-events: none } makes document.elementFromPoint
return the root, so the probe attaches its click counter to <html>; on head and the mutant it
attaches to a <div>. So "0/3 on base" means <html> received the click, not that the control
underneath fired. The head-vs-mutant comparison is unaffected -- both are the same <div> --
and that is the comparison the kill control actually rests on, but the base-vs-head contrast is
softer than the bare numbers suggest.

This has a consequence worth stating in plain terms rather than leaving as a 3/3.
underlying_swallowed 3/3 together with neutral_click_after 3/3 means: with a menu open, a
user who clicks a control must press it twice to activate it.
The first press dismisses the
menu and is eaten by the guard; the second press works normally. That is the guard's deliberate
design, inherited from #9051, and it is not new here. But whether it is an improvement on what
the modal layer did cannot be settled from these numbers, because the base column is the
confounded <html> measurement above and so the two are not comparable. It is reported as a
described behaviour, not as a pass.

3. One touch row is chromium-only and was previously written as if it held everywhere. See
below.

4. Only 28 of the 77 checks in the matrix can be shown to measure anything. Four separate
instrument defects were found while preparing this PR, and every one produced plausible-looking
numbers:

  1. a matrix run whose harness was edited after it ran (results 20:49:12, harness 20:55:54), so
    the numbers came from a version that no longer exists;
  2. a probe that targeted an inline rename which never opens a dialog, and so reported "no
    dialog" on the arm that definitely has a modal layer;
  3. a probe that scrolled a thread already pinned to the bottom (room_up 170,256,
    room_down 0), so a scroll-locked arm and an out-of-room arm both reported 0 px moved;
  4. a second overlay probe defeated by the finding itself: with a menu open the first outside
    press is always consumed, so the button it pressed never activated and it measured the
    swallow rather than the dialog.

None is visible by reading the code and none looks wrong in the output. All four were caught
by the same signature: a check that read identically where it should have differed, or a bare
zero that could not distinguish absence from unreachability.
That is the thing to look for
when touching this harness.

So the same standard this PR applies to its assertions (a mutant must kill each one) is applied
to the probes themselves. scripts/menu3_discrimination.py sweeps every check and asks what it
reads on an arm where the behaviour is present against one where it is absent:

matrix focus / overlay
discriminates between arms 28 see note
reads identically on base, head and mutant 49 see note

The 49 split into two honest groups. Most are regression guards that cannot discriminate by
construction
, because no arm lacks the behaviour they test: mouse_open, item_count,
dismiss_closes, select_reached_item, select_took_effect, all three keyboard_*,
touch_open, dblclick_outside_closes. They are legitimate as "nothing broke" statements and
they are reported as exactly that -- not as evidence the change works, and with their own
instruments unvalidated
, since nothing in this experiment makes them fail. The rest are the
cases named above where the interaction never fires on any tree (the list-header menu's
held, quick and dismiss-then-Space presses; chromium's touch_dismiss_closes on the sidebar
"Chat options" menu), and those are stated as non-discriminating rather than as passes.

The general principle behind the scroll fix is worth stating because it applies to all of them:
a probe must be able to distinguish "the thing did not happen" from "I could not make the
thing happen".
A bare 0 cannot.

Four rows are reported as they were observed rather than as passes:

  • touch_dismiss_closes on the sidebar "Chat options" menu comes back 0/3 on base, head and
    the mutant alike on chromium only. On firefox and webkit that same cell is 3/3 on all
    three trees. A tap on the neutral spot does not close that one menu on chromium on any tree,
    so it is pre-existing and not a regression, but it is not a pass either.
  • the held-press case on the list-header menu does not discriminate: 0/3 on all three trees,
    because the row the harness presses is not adjacent enough to that menu to close it. The
    same is true of the quick-press and dismiss-then-Space cases on that menu: it is not that
    the guard holds there, it is that the press never dismissed that menu to begin with.
  • the probe's neutral press does not land on the same element on both arms, and it cannot.
    On base, body { pointer-events: none } makes elementFromPoint return the root, so the
    base arm's click counter is attached to <html> while head's and the mutant's are attached
    to a <div>. So underlying_swallowed 0/3 on base means "<html> received the click", not
    "the control underneath fired". The head-vs-mutant comparison is unaffected, since both are
    the same <div>, and that is the comparison the kill control rests on.
  • on base, the project page menu could not be reopened after a dismissal (1/10), so the
    later rows in that column are absent. Head reopens it 10/10. I have not established whether
    that is a real base-tree defect or a harness artefact, and I am not claiming it as a fix.

The behaviour changes, stated rather than left to be discovered

The bar for this PR is identical-except-for-performance. It does not fully meet that bar, so
the differences are listed here with their measurements rather than left to be found.

1. The thread scrolls behind an open menu, where before it was locked

Going non-modal drops the react-remove-scroll scroll lock along with the pointer-events
write. Measured, one of these menus open, a real wheel gesture over the thread:

base this branch
thread scrollTop delta 0 px -900 px (chromium), -860 px (firefox)
menu still open afterwards yes yes
menu moved no, [0, 0] no, [0, 0]

The menu does not close and it does not move. That second half is what makes this benign
rather than a detached-popover bug: the menu is anchored to a trigger that lives in the
sidebar, and the sidebar is a separate scroll container from the thread, so scrolling the
thread cannot move the trigger the menu is attached to. Escape still closes it and scrolling
back restores the view.

An earlier version of this section, and a since-corrected comment below, said the scroll
carries the menu off screen with its trigger. That was wrong, and the evidence image
refutes it: 0 differing pixels for x < 402, so the sidebar and the open menu are
byte-identical between the two sides.

The wheel-over-the-SIDEBAR case is unmeasurable in this fixture: the sidebar does not
overflow (scrollHeight 753 against clientHeight 753, identical), so there is nothing to
scroll. It is not claimed either way.

app-sidebar.tsx already ships a modal={false} menu with this behaviour, so it is the
existing precedent rather than a new shape.

2. Focus is not returned to the trigger when an outside PRESS dismisses the menu

Pre-existing defect, filed as #9245, extended to three more menus by this PR and not fixed
here.
It reproduces on main today on the sidebar's already-non-modal "More" menu, on all
three engines. The mechanism is established and a fix is designed in that issue; its
recommended home is #9051, which owns the guard. This PR does not introduce it and does not
own the file it lives in.

Escape is unaffected and is the path that matters most for keyboard and screen-reader users:
focus_return_escape is 3/3 on base, this branch and the mutant, all three menus, all three
engines. Focus returns to the trigger button with its accessible name.

Dismissing with an outside press is different:

base this branch guardless mutant
focus after the press trigger BUTTON BODY TEXTAREA (it navigated)

focus_detached and focus_in_menu_subtree are both false, so it is a clean drop to <body>,
not focus stranded on an unmounted node.

This is inherited from the guard, not introduced here. The control settles it exactly as it
did for the double click: the sidebar's overflow "More" menu is ALREADY modal={false} with the
same guard on the base tree, untouched by this PR, and it drops focus to <body> on base,
on all three engines. So the behaviour belongs to the non-modal-plus-guard pattern and this PR
extends it to three more menus. Filed as #9245.

The mechanism, from a focus timeline sampled at every event of the gesture:

base   pointerdown -> menu content ... blur -> BODY ... click -> BODY
       +50ms -> BODY   then  focusin -> BUTTON[Chat options]      <- Radix restores, late
this   pointerdown -> menu content ... focusin -> BUTTON{the row} <- the press focuses the row
branch click(capture) -> the row ... blur -> BODY                 <- the guard blurs it
       +1000ms -> BODY                                            <- Radix never restores

Two things combine. The press focuses the row (on base it cannot, because
pointer-events: none sends the press to HTML), so Radix sees focus already outside the menu
and declines to restore it. Then releaseFocusTakenByTheSwallowedPress in menu-dismiss.ts
calls active.blur() to kill the pending Space activation, and nothing puts focus back.

That blur is deliberate and load-bearing: it is what makes dismiss_then_space_did_not_navigate
pass, one of the checks proven to discriminate. So the fix is not to remove it but to redirect
it, focusing the trigger instead of blurring to nothing, which removes the pending activation
and restores the recovery point in one move.

The comment in menu-dismiss.ts that chose blur over restore says "measured on the pre-PR
shape, document.activeElement stays BODY throughout"
and "Body is where the modal shape
left focus anyway"
. The timeline above shows why that is half right: on base focus IS BODY
through pointerdown, click and +50 ms, and then Radix's restore lands and it ends on the
trigger. The observation was taken at the wrong instant, and the end state is the opposite.

3. The shared guard's double-click over-swallow

One defect in the shared guard comes with it, and it is not mine to claim as new. A fast
double click outside an open menu loses its second click: the guard swallows both. Measured
10 times per arm, the three converted menus deliver 0 of 2 on this branch. The control settles
it: the sidebar's overflow "More" menu is ALREADY modal={false} with the same guard on the
base tree, untouched by this PR, and it delivers 0 of 2 on base as well, 10 times out of 10.
The guardless mutant delivers 2 of 2. So the over-swallow belongs to menu-dismiss.ts and
predates these three menus; this PR extends the guard's reach and the behaviour travels with
it. Worth fixing in the guard, not here.

4. A control must be pressed twice to activate it while a menu is open

underlying_swallowed 3/3 with neutral_click_after 3/3 means the first press outside an open
menu is consumed and the second lands. That is the guard's deliberate design, inherited from
#9051. As noted above, it cannot be compared against base from this data, because the base
column is the confounded <html> measurement. It is described, not scored.

A modal dialog still shields these menus

The risk that justifies all of the above: Radix's modal layer is what normally guarantees
overlay stacking, so taking three menus off it could let them punch through a modal dialog. It
does not. A genuinely modal dialog (open={creatingProject}, confirmed
getComputedStyle(document.body).pointerEvents === "none" on every arm, including this branch)
was opened with no menu open, and the menu trigger was then pressed.

menu_blocked_by_modal_dialog, 3/3 in every cell, identical on chromium, firefox and webkit:

menu base this branch guardless mutant
sidebar "Chat options" blocked blocked blocked
sidebar "Organize chats" blocked blocked blocked
CONTROL: sidebar "More", already non-modal on base not blocked not blocked not blocked

base equals this branch on both converted menus, so there is no regression, and the dialog
keeps its own shield on this branch (dialog_is_modal, dialog_has_focus,
dialog_escape_closes and body_restored_after_close all true everywhere).

The control is the reason to believe the check rather than the number it produced: it reports
"not blocked" while the converted menus report "blocked", in the same run, so the check is
demonstrably able to move rather than stuck on one value.

Two things this does NOT establish. dialog_still_open_after is false in every cell, so the
trigger press also dismisses the dialog, and what is measured is strictly that a press at the
trigger's location does not produce a menu while a modal dialog is up. Whether that is because
the dialog refuses the press or because the hover-revealed trigger is simply unreachable under
pointer-events: none is unestablished; the verdict survives because base behaves
identically, but the mechanism does not follow from this data.

That control result is itself a pre-existing defect on main, filed as #9244. It is not caused
by this PR, it reproduces identically on base, and it is deliberately not fixed here.

The general lesson from the evidence in this PR

Stated once rather than repeated as three separate caveats: a check can support a comparison
between arms while being unable to support a claim about why either arm behaves as it does.

Most of the results above are of the first kind. Where a mechanism is asserted, it is because
something independent establishes it; where it is not, that is said.

The eleven-menu count, and the file to leave alone

features/chat/thread-sidebar.tsx has ZERO importers. Nothing under src/ or tests/
references it and vite tree-shakes it out, so the two menus #9051 converts there never mount;
that is why its headline count of eleven is eight live menus. This PR does not touch it, and
the new test pins that fact with an importer sweep, so if it ever gains an importer the test
says so instead of the menus quietly joining the matrix unmeasured.

Tests

studio/frontend/tests/sidebar-menu-modality.test.ts, four tests: each of the three menus is
pinned non-modal AND guarded, and the two pinned files are required to have live importers
while thread-sidebar.tsx is required not to.

Every assertion was shown to fail on a deliberately broken tree, individually: ten
mutations, each turning exactly one test red, with the tree checksummed between them and
green again at the end. Six flip one half of one site (modal back on, or the guard removed);
one gives thread-sidebar.tsx an importer; one pins a file that has none; one makes the
source walk reach nothing; one points a marker at a menu that does not exist.

The runtime assertions were shown to kill something too. A third Studio serves a mutant build
that is this branch with modal={false} kept and <MenuDismissGuard /> removed.

underlying_swallowed is 3/3 on head and 0/3 on the mutant on all three menus and all
three engines, and touch_underlying_swallowed likewise on firefox and webkit. The
double-click counter inverts just as cleanly: head delivers 0 of 2 ten times out of ten, the
mutant 2 of 2 ten times out of ten, on every menu and every engine.

held_dismiss_did_not_navigate, quick_dismiss_did_not_navigate and
dismiss_then_space_did_not_navigate are 3/3 on head and 0/3 on the mutant on the two "Chat
options" menus
-- the dismissing press navigates away. On the list-header menu those three
are 3/3 on the mutant as well, so they are not a kill there; as noted above, the harness's
press never dismisses that menu on any tree, so there is no swallowed click for the guard to
be credited with. The list-header menu's kill rests on underlying_swallowed,
neutral_click_after, touch_underlying_swallowed and the double-click counter instead.

One cell does not kill and is reported rather than dropped: touch_underlying_swallowed on
the sidebar "Chat options" menu is 3/3 on the mutant on chromium, where the tap does not
close that menu at all, so it never reaches the element being counted. It kills normally on
firefox and webkit.

Gates

npm run typecheck (tsc -b plus tsconfig.test.json) and npm run build both pass.
npm test is 3799/3800; the one failure is queued-model-capabilities.test.ts, the inherited
ERR_MODULE_NOT_FOUND that #9220 fixes, and it fails identically on the base worktree.

npx eslint on the two changed source files reports 19 problems (9 errors, 10 warnings) on
this branch and the identical 19 on base
, differing only by a two-line offset that matches
the two lines this PR adds to chat-page.tsx. All of them are pre-existing
react-hooks/set-state-in-effect and exhaustive-deps findings in code this PR does not
touch. The new test file lints clean.

Note npm run typecheck is tsc -b. tsc --noEmit -p tsconfig.json checks nothing here,
because that config is references-only.

CI

The four red checks on this PR are main-side and are not from this change. (Python 3.13),
Frontend build + bundle sanity, Frontend unit tests (Windows) and Repo tests (CPU) fail
identically on every open PR against this base, including ones that touch no frontend code at
all. They are fixed by #9220, which is green at 38/0. The other 28 checks pass here. Please do
not read this PR as red.

Fixes #9168.

@danielhanchen

Copy link
Copy Markdown
Member Author

UI evidence: the menus are identical, and the one thing that changed is behind them

Two isolated installs, install.sh --local on each side so each serves a frontend built from
its own tree. BEFORE is 2da3c55 (#9051's head) and AFTER is de7db20 (this branch),
given explicitly rather than taken from a merge base, because this PR is stacked on #9051 and
cannot build without its guard. Each side was checked to be answering on its own port with its
own build before anything was photographed.

This is a performance change, so three of the four shots are an IDENTITY assertion. They hold,
at the pixel:

shot differing pixels verdict
1. sidebar per-thread "Chat options" open 0 of 1,100,800 byte-identical
2. same menu open, wheel over the thread 312,177 (28.4%) the intended difference
3. sidebar list-header "Organize chats" open 2, max channel-sum delta 76/765 subpixel antialiasing on one glyph edge
4. project page per-chat "Chat options" open 0 of 1,100,800 byte-identical

Menu geometry and contents agree exactly on both sides: [232, 411, 224, 322] for the sidebar
menu, [15, 516, 224, 244] for the list header, [896, 489, 224, 268] for the project page,
with the same 8, 5 and 7 items, and the first item hit-tests to itself on both.

1. sidebar per-thread "Chat options" -- byte-identical

sidebar chat options

2. the same menu, still open, with a real wheel gesture over the thread

This is the behaviour change named in the PR body, and it is the only visible one. BEFORE the
thread does not move, because a modal layer locks scrolling with react-remove-scroll. AFTER
it scrolls 900 px and carries the menu's trigger with it. The menu does not close on either
side
(menu_still_open_after_wheel is 1 on both); Escape closes it and scrolling back
restores it, which the scene then does and confirms (scroll_fully_restored true on both).
The difference is confined to the thread pane: the changed-pixel bounding box is
(402, 48)-(1147, 748) and the sidebar is untouched.

wheel behind the open menu

3. sidebar list-header "Organize chats" -- 2 pixels of antialiasing

organize chats

4. project page per-chat "Chat options" -- byte-identical

project page chat options

The facts that did move

Read off the same servers that were photographed:

organize_body_pointer_events:   "none" -> ""
organize_body_scroll_locked:     true  -> false
project_body_pointer_events:    "none" -> ""
project_body_scroll_locked:      true  -> false
sidebar_body_pointer_events:    "none" -> ""
sidebar_body_scroll_locked:      true  -> false
sidebar_aria_hidden_siblings:      13  -> 0
scroll_with_menu_open:    [7628, 7628] -> [7628, 6728]
scrolled_px_with_menu_open:         0  -> -900

That pointer-events: none on <body> is the whole change: it is an inherited property, so
the write invalidates computed style for the entire thread, which is why the cost of opening
one of these menus used to scale with the conversation and no longer does.

A note on the run itself, since it matters for reading the numbers above. The driver exits
non-zero when the two sides come out byte-identical, and here that is the desired outcome for
three of the four shots rather than a failure, so its verdict is inverted for those. What must
never be identical is shot 2, and it is not: 312,177 pixels and nine facts.

@danielhanchen

Copy link
Copy Markdown
Member Author

Correction: my earlier UI evidence comment described the wheel gesture wrongly

In the UI evidence comment above
I wrote that with one of these menus open, a wheel gesture "scrolls the thread and carries the
menu off screen with its trigger", and the PR body said the same. That is wrong, and it is
wrong about the very image it was published beside. I am leaving the original comment in place
rather than editing it into looking correct.

What the image actually shows

Measuring the two underlying shots of shot 2 (BEFORE_2_wheel_behind_open_menu.png against
AFTER_2_wheel_behind_open_menu.png, 1280x860) pixel by pixel:

total differing pixels        312,177
bounding box of differences   x 402-1146,  y 48-747
differing pixels with x < 402       0

Zero. The entire left 402 px of the frame -- the whole sidebar, the trigger, and the open menu
itself -- is byte-identical between the two sides. The menu does not move, and neither does its
trigger.

Why, and why it was predictable

The sidebar is its own scroll container. A wheel gesture over the thread pane scrolls the
thread pane; it cannot move a trigger that lives in a different scroll container, whatever the
modal layer is doing. The thing modal={false} actually removes here is
react-remove-scroll's lock, so the difference the shot captures is that the thread scrolls at
all where before the gesture did nothing. That is a real and correctly captured difference. The
claim layered on top of it, that the menu rides along, was not measured and is not true.

What actually happens, measured

Rather than replace one unmeasured sentence with another, I instrumented both scroll containers
on both arms. With one of these menus open and a real wheel gesture over the thread:

base this branch
thread scrollTop delta 0 px -900 px (chromium), -860 px (firefox)
menu still open afterwards yes yes
menu moved no, [0, 0] no, [0, 0]

So the real difference is that the thread scrolls behind the open menu where before it was
locked
, and the menu does not move. Both arms agree the menu stays put.

That last fact is what makes this benign rather than a detached-popover bug: the menu is
anchored to a trigger that lives in the sidebar, and the sidebar is a separate scroll
container
from the thread. Scrolling the thread cannot move the trigger, so the menu stays
correctly attached to something that never moved.

One thing this could NOT test, stated rather than glossed: the sidebar itself does not overflow
in this fixture (scrollHeight 753 against clientHeight 753, identical), so the
wheel-over-the-sidebar case is unmeasurable here
. I am not claiming it either way.

A note on the first version of the probe, because it is the same trap in a different costume.
It scrolled DOWNWARD, and the thread mounts fully scrolled to the bottom (room_up 170,256,
room_down 0). So the gesture had nowhere to go and returned 0 px on BOTH arms, which reads
exactly like "no difference" while actually meaning "I could not make the thing happen". It was
caught because the composite had independently measured -900.

Where each half of this correction comes from

Worth separating, because the two halves rest on different evidence:

  • the refutation is off the composite's own PNGs, compared pixel by pixel. It needed no
    probe and it stood the moment it was measured.
  • the replacement claim is from a separate instrumented run, and I deliberately held this
    correction back until that run existed. Replacing a confident unmeasured sentence with a
    different confident unmeasured sentence would have been the same mistake twice.

What this does and does not change

Nothing about the performance result or the functional matrix depends on this: it was a
description of a side effect, not a measurement anyone reasoned from. But it was stated as
observed fact next to an image that refutes it, so it needed correcting in public rather than
quietly in the PR body. The PR body has been corrected too, and the scroll behaviour is now
listed there as a stated behaviour change with its measurement, alongside the others, rather
than only as the correction of a bad sentence.

@danielhanchen

Copy link
Copy Markdown
Member Author

Confirmed the three sites in app-sidebar.tsx and chat-page.tsx are still on the body modal layer on main, and the guard only exists on the #9051 branch, so the ordering here is right. Will get this reviewed once #9051 lands and this retargets.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 19, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

Closing this. Measured at 100K against a concurrent in-band null control and every metric landed inside the run's own floor.

It also stacks on #9051, which conflicts with main and has no prepared rebase, so what was actually measured here was the 9051 plus 9229 stack rather than this change alone. Neither half showed anything. Closing both.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant