Repository navigation
Description
Summary
Opening or closing the right panel freezes the page before the panel starts moving. On wide windows a second, similar stall lands partway through the slide. Both come from core inserting or removing DOM nodes during the toggle: the thread header's right-panel button, and the thread table-of-contents rail. With plugin or theme CSS that uses :has(), each insertion or removal makes Chromium restyle the whole page. Expected: the panel starts moving within about one frame.
Versions and environment
mainat c738623. The same code is in the current Nightly desktop app (Electron).- macOS, Apple Silicon. Measured in headless Chromium against a production build of the web app.
- Unusual about the setup: about 35 plugin stylesheets plus a custom theme are loaded, together containing roughly 170
:has()rules. Core CSS alone does not show the stall.
Steps to reproduce
- Install plugins or a theme whose CSS contains
:has()rules with a descendant or universal subject, for example[data-x]:has(> button[aria-label="..."]) > :not(...)ordiv:has(> div > button[aria-label="..."]) *. Any one such rule is enough. - Open a thread with at least three user messages in a window at least 1440 px wide.
- Toggle the right panel with the header button or ⌘J several times.
Tried and did not reproduce: the same toggles with plugin stylesheets disabled (35–50 ms input-to-first-frame at 4× CPU throttling). Disabling the slide transition does not remove the up-front stall.
Expected vs actual
Expected: the panel starts moving within about one frame; no long frames during the slide.
Actual (4x CPU throttle, median of repeated toggles):
input to first frame: 268–278 ms at 1024, 1440 and 1920 px
longest frame during the slide at 1920 px: about 283 ms
Evidence
- The header toggle is unmounted while the panel is open on desktop and mounted again on close: and
bb/apps/app/src/views/thread-detail/ThreadDetailHeader.tsx
Lines 193 to 194 in c738623
const showRightPanelToggle = secondaryPanelHost === null && (!isSecondaryPanelOpen || isCompactViewport); {showRightPanelToggle ? ( - The table-of-contents rail is unmounted below 56 rem: and
setVisible(inlineSize >= TOC_MIN_VISIBLE_WIDTH_PX); . Opening the panel on a window wider than about 1120 px shrinks the timeline across that breakpoint mid-transition, so the rail is removed (or, on close, inserted) during the animation.bb/apps/app/src/components/thread/toc/ThreadTableOfContents.tsx
Lines 720 to 845 in c738623
{tocVisible ? ( <div className="relative"> <button type="button" aria-label="Thread table of contents" aria-expanded={open} aria-controls={`thread-toc-panel-${threadId}`} onClick={() => setOpen(true)} className="no-scrollbar flex max-h-[calc(100vh-7rem)] w-8 cursor-pointer flex-col items-center gap-2 overflow-y-auto py-2" > <span aria-hidden className="flex w-full flex-col items-center gap-2" > {railItems.map((item) => ( <span key={item.id} className={cn( "h-[3px] shrink-0 rounded-full transition-all duration-150", item.id === activeUserId ? "w-5 bg-foreground/30 group-hover/toc:bg-foreground/70" : "w-3 bg-foreground/5 group-hover/toc:bg-foreground/20", )} /> ))} </span> </button> {open ? ( <div id={`thread-toc-panel-${threadId}`} className="pointer-events-auto absolute right-full top-0 w-[18.25rem] max-w-[calc(100vw-3rem)] pr-1" > <div className="rounded-lg border border-border bg-popover p-1 shadow-lg"> <div className="flex items-center gap-1 pb-1"> {hasAgentMessages ? ( <TocPanelTab label="Agent messages" active={activeTab === "agent"} onSelect={() => setTab("agent")} /> ) : null} <TocPanelTab label="Your messages" active={activeTab === "user"} onSelect={() => setTab("user")} /> </div> <div className="relative isolate"> <div ref={scrollRef} className="max-h-64 overflow-y-auto overflow-x-hidden" > <div ref={topSentinelRef} aria-hidden className="h-px w-full" /> <ul className="flex flex-col"> {items.map((item) => { const active = item.id === activeId; const pending = item.id === pendingJumpId; return ( <li key={item.id}> <button ref={(node) => { if (node) itemEls.current.set(item.id, node); else itemEls.current.delete(item.id); }} type="button" aria-busy={pending} onClick={() => { void handleSelect(item.id); }} className={cn( "flex w-full cursor-pointer rounded-md px-2 py-1.5 text-left transition-colors", active ? "bg-state-hover" : "hover:bg-state-hover", )} > <span className={cn( "text-xs leading-snug", active ? "text-foreground" : "text-muted-foreground", pending && "animate-pulse", )} > <TocItemPreview item={item} senderThreadMetadataById={ senderThreadMetadataById } /> </span> </button> </li> ); })} </ul> <div ref={bottomSentinelRef} aria-hidden className="h-px w-full" /> </div> {aboveOverflow ? ( <div aria-hidden className="pointer-events-none absolute inset-x-0 top-0 z-10 h-8 bg-gradient-to-b from-popover/90 via-popover/60 to-transparent" /> ) : null} {belowOverflow ? ( <div aria-hidden className="pointer-events-none absolute inset-x-0 bottom-0 z-10 h-8 bg-gradient-to-t from-popover/90 via-popover/60 to-transparent" /> ) : null} </div> </div> </div> ) : null} </div> ) : null} - A Chromium trace with invalidation tracking shows the toggle marking every ancestor "Affected by :has()" up to the app root, then invalidating whole subtrees ("allDescendantsMightBeInvalid"). The resulting forced style recalculation covers about 1,100–2,300 elements.
- Replaying single mutations in the loaded page at 1× CPU: removing and reinserting the header button costs about 52 ms of forced style recalculation; toggling a
hiddenclass on it costs 0.8 ms; togglinginert,aria-expandedoraria-pressedcosts 0.4–0.9 ms. Removing every:has()rule brings the full toggle down to about 40 ms at 4× throttle; removing any single stylesheet's:has()rules does not. - Measurement method: production build served against a local server, headless Chromium,
Emulation.setCPUThrottlingRate4, requestAnimationFrame timestamps around a click on the visible toggle, and Chromium trace events for style recalculation.
What you ruled out
- Not the slide animation: disabling the panel's flex transition leaves the up-front stall unchanged, and frames during the slide are about 17 ms when nothing mounts.
- Not panel content: the panel stays mounted after the first open (the first open has an extra mount cost, not covered here).
- Not a duplicate of Right panel polish: toggle jump, open/close reflow, tab-strip rough edges #435 (closed right-panel polish issue about layout jumps, not restyle cost).
- Plugin and theme
:has()rules make the cost large, but the trigger is core's mount and unmount. Rule-by-rule clean-up did not converge: many unrelated rules each re-create most of the cost.
Suggested priority and effort
Hits any user with :has()-heavy plugin or theme CSS on every right-panel toggle; there is no workaround short of removing that CSS. No data loss. Small change: keep both elements mounted and hide them.
Checks
- I reproduced this on the latest release or on
main, or I say above that I could not. - I searched open and closed issues for the same problem.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 28, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotui,perf,partial-repro(all previously missing; no existing values replaced).:has()invalidation and frame timing remain unverified because the required browser backend lacks Chrome/Chromium.Keep the right-panel toggle and table-of-contents rail mounted while …