Skip to content

fix(PlayerCore): fix output auto-scroll stutter and picture-frame occlusion - #2009

Merged
alexwarren merged 1 commit into
mainfrom
fix/autoscroll-picture-frame
Aug 9, 2026
Merged

fix(PlayerCore): fix output auto-scroll stutter and picture-frame occlusion#2009
alexwarren merged 1 commit into
mainfrom
fix/autoscroll-picture-frame

Conversation

@alexwarren

Copy link
Copy Markdown
Contributor

Summary

Restores the game output panel's "scroll just far enough to reveal the start of new text, don't jump to the document's end" behavior, and fixes several compounding bugs uncovered while chasing it down (auto-scroll on mobile jumping straight to the bottom, "The Shack"'s static picture frame hiding text behind it):

  • The clamped-scroll logic existed years ago but was accidentally gutted in a past cleanup — only its dead fallback (unconditional jump to document.body.scrollHeight) survived, with its counterpart bookkeeping left behind unused.
  • A jQuery animation-queue pileup made rapid successive turns (e.g. a fast walkthrough) visibly stutter — fixed by clearing any in-flight animation before starting a new one, and using linear easing when interrupting an already-running scroll instead of restarting the eased curve.
  • The sticky picture frame (#gamePanel/#gridPanel) and status bar's reserved space wasn't accounted for, so new text could render behind them.
  • #gameContent's own offset from the page top wasn't accounted for once the picture frame pushed it down in the layout.
  • .focus() on the command input — when it wasn't already focused (common on mobile before the on-screen keyboard is tapped) — silently triggered the browser's native scroll-into-view, discarding the computed position.
  • Chrome's scroll anchoring was compensating for layout shifts on its own terms, ahead of and in conflict with our own positioning logic.
  • ClearScreen() (used by "Continue" links / gamebook page transitions, including game start) had its own separate, never-fixed scroll-to-0 logic; and a stale pre-clear scroll target could land far past the new page's actual content before ClearScreen's own correction ran — fixed by letting that correction move the scroll backward when needed.
  • A picture still mid-load has no real height yet, so scrolling before it settles could still land text where the picture was about to expand into — fixed by deferring the scroll until any pending panel image resolves (success or failure), guaranteed via a load/error listener.

Test plan

  • dotnet test tests/EngineTests / tests/PlayerCoreTests — all pass
  • Full tests/e2e/verify-wasmplayer-*.mjs suite (11 scripts, including 5 new ones for this fix) — all pass
  • Verified directly against the real "The Shack" (title screen, help screen, and in-game picture transitions) on a small/mobile-sized viewport

🤖 Generated with Claude Code

…lusion

Restores the clamped "scroll to reveal the start of new output, not the
document's end" behavior that was accidentally gutted in a past cleanup
(only its dead fallback survived), fixes several compounding bugs found
along the way: a jQuery animation-queue pileup causing rapid turns to
stutter, missing accounting for the sticky picture-frame/status-bar chrome
and #gameContent's own page offset, a focus()-triggered native scroll
hijack, scroll-anchoring fighting our own positioning, a stale pre-clear
scroll target during ClearScreen, and a visible flash while a picture is
still loading. Verified against WasmPlayer's debugger walkthrough runner
with synthetic fixtures and against the real "The Shack" game.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@alexwarren
alexwarren merged commit 33ce1a5 into main Aug 9, 2026
7 checks passed
@alexwarren
alexwarren deleted the fix/autoscroll-picture-frame branch August 9, 2026 11:24
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.

1 participant