Skip to content

fix(chat,layout): stop subpixel jitter under #topbar when reasoning is expanded#72

Merged
xaspx merged 2 commits into
xaspx:mainfrom
tomekpanek:fix/reasoning-nested-scroll-jitter
Jun 4, 2026
Merged

fix(chat,layout): stop subpixel jitter under #topbar when reasoning is expanded#72
xaspx merged 2 commits into
xaspx:mainfrom
tomekpanek:fix/reasoning-nested-scroll-jitter

Conversation

@tomekpanek

Copy link
Copy Markdown
Contributor

Symptom

Scrolling chat with an assistant message's reasoning section (or any tool result inside <details>) expanded produces a visible 1–2 px vertical jitter on text under #topbar. Persists for the duration of smooth-scroll inertia, especially noticeable on Chrome/Edge on Windows with non-integer DPI scaling (125%/150%).

Diagnosis — two compounding causes

Verified during testing: neither fix alone eliminates the jitter; both are required.

Cause A — nested scroller (src/css/chat.css)

.msg-tool-result (the wrapper holding reasoning text and tool results inside <details>) had max-height: 250px; overflow-y: auto, making it a nested scroller inside .chat-messages. Each outer-page scroll frame triggered scroll-anchoring computations on the inner scroller; sub-pixel layout shifts cascaded into the compositor.

Cause B — backdrop-filter resampling (src/css/layout.css)

#topbar has backdrop-filter: blur(16px) over a semi-transparent background. During smooth-scroll inertia, the page behind the topbar shifts by sub-pixel offsets each frame. The backdrop resamples on every frame and on non-integer DPI the resampled output has slightly different anti-aliasing weights — visible as text-rendering churn directly below the header.

Confirmation

Runtime DevTools tests (each tested in isolation, then together):

// Test A — disables Cause A
document.querySelectorAll('.msg-tool-result').forEach(e => {
  e.style.maxHeight = 'none';
  e.style.overflow = 'visible';
});

// Test B — disables Cause B
document.getElementById('topbar').style.backdropFilter = 'none';

Result: A alone — still jitters. B alone — still jitters. A + B — jitter gone.

Pixel-diff of recorded scroll: ~1.1% of pixels change per frame, max ΔL = 3/255, with diff bands aligned with text baselines (anti-aliasing fingerprint, not codec noise).

Fix

Two changes, both required:

  1. src/css/chat.css — remove max-height: 250px and overflow-y: auto from .msg-tool-result. Both reasoning and tool-result content already live inside <details> — the user opts in to expand; long content flows with the page, collapsing is the escape hatch.

  2. src/css/layout.css — add transform: translateZ(0) and will-change: backdrop-filter to #topbar. Pins the topbar to its own GPU composition layer with a stable filtered texture instead of recompositing every sub-pixel scroll tick.

Verified by

End-to-end test on top of main (204e0e5, v3.6.0): repro session with expanded reasoning + flick-scroll no longer shows any jitter on text below the header. Glass effect intact. Reasoning content readable, just no internal scrollbar anymore.

@tomekpanek tomekpanek force-pushed the fix/reasoning-nested-scroll-jitter branch from c654aa2 to 100d9cd Compare June 3, 2026 21:57
@xaspx xaspx merged commit 76e118d into xaspx:main Jun 4, 2026
0 of 3 checks passed
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