mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-15 04:01:05 +00:00
7db6fd8650
The sync-frame guards (_fixMobileScrollJank / _suppressBrowserOverflowAnchor) only cover the render frame itself. postProcessRenderedMessages() — syntax highlight, inline diff/csv/pdf/html/excalidraw, katex/mermaid — is scheduled a FRAME LATER via requestAnimationFrame(), after those guards have released. Each of those can change the height of rows ABOVE the viewport; on mobile (overflow-anchor:auto) the browser's native anchor engine then compensates scrollTop a SECOND time in that unguarded frame, yanking an unpinned reader to another turn (the residual mobile 往回大跳). Wrap all three deferred post-process dispatches (fast-path cache branch, main render tail, live-tool remount) in _postProcessWithAnchorSuppression(), which routes through the shared _suppressBrowserOverflowAnchor() and holds suppression one extra frame so late media/layout reflow is covered too. Desktop rests at overflow-anchor:none so the wrapper is a verified no-op there. Reproduced on an isolated debug instance with a cloned 1179-message session: above-viewport +350px during the async settle window jumped scrollTop +350 on mobile (auto) and 0 with the wrapper; desktop (none) 0 both ways. static/ui.js only.