Fix editor scroll jump during typing at end of long documents#343
Merged
Conversation
Guard previewBoundsDidChange: with _inEditing to break the feedback loop where DOM replacement's window.scrollTo() triggers reverse scroll sync back into the editor. Also guard the MathJax completion callback's syncScrollers call for the same reason. Both fixes mirror the existing _inEditing pattern from the #282 fix in editorBoundsDidChange:. Additionally fixes a secondary inconsistency where syncScrollersReverse was called outside the !_inLiveScroll guard with stale header data. Related to #342 https://claude.ai/code/session_01GFGosaQntktYnAJgv7fCpw
Contributor
Code Coverage ReportCurrent Coverage: 57.22% Coverage Details (Summary) |
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
previewBoundsDidChange:with_inEditingto break the feedback loop where DOM replacement'swindow.scrollTo()triggers reverse scroll sync back into the editor, causing the scroll jump reported in Editor still jumps while typing at end of long document #342DOMReplacementDonecompletion callback'ssyncScrollerscall with the same_inEditingcheck, preventing the same cascade via the async MathJax pathsyncScrollersReversewas called outside the!_inLiveScrollguard with stale header dataBoth fixes follow the established
_inEditingpattern from the #282 fix ineditorBoundsDidChange:.Related to #342
Test plan
testPreviewBoundsDidChangeSkipsSyncWhenInEditing— verifies reverse sync is suppressed during editingtestPreviewBoundsDidChangeSyncsWhenNotInEditing— verifies no over-suppression of legitimate preview scrollingtestPreviewBoundsDidChangeRespectsGuardFlag— verifies early-return path