fix(PlayerCore): fix output auto-scroll stutter and picture-frame occlusion - #2009
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
document.body.scrollHeight) survived, with its counterpart bookkeeping left behind unused.#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.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 beforeClearScreen's own correction ran — fixed by letting that correction move the scroll backward when needed.Test plan
dotnet test tests/EngineTests/tests/PlayerCoreTests— all passtests/e2e/verify-wasmplayer-*.mjssuite (11 scripts, including 5 new ones for this fix) — all pass🤖 Generated with Claude Code