Skip to content

fix(viewer): keep scroll anchor across wrap toggles and stop scroll stutter on upward scroll - #22

Merged
usamaiqb merged 2 commits into
mainfrom
fix/viewer-scroll-stutter
Aug 20, 2026
Merged

fix(viewer): keep scroll anchor across wrap toggles and stop scroll stutter on upward scroll#22
usamaiqb merged 2 commits into
mainfrom
fix/viewer-scroll-stutter

Conversation

@usamaiqb

Copy link
Copy Markdown
Owner

No description provided.

ScrollView.onSizeChanged re-scrolls to keep a focused descendant
visible. Code blocks are selectable TextViews and therefore focusable,
and the chrome's expand/collapse animation resizes the viewport every
frame — so that automatic scroll landed mid-drag, and the deltas it
emitted flipped the chrome's own show/hide threshold straight back.

Also stop routing the live scroll position through composition. It
recomposed the whole screen, and the AndroidView update block, on
every scroll frame, where an animated text colour then rebuilt the
segment view tree and cancelled the gesture in flight.
A table segment has no TextView, so resolving its anchor fell through
to 0 and sent the viewer to the top of the document. Distinguish
"unresolvable" from "position 0" and hold position instead.

Also fix the double-counted container padding in the split path,
narrow the focused-descendant scroll suppression to the two callers
that actually misbehave so selection handles still auto-scroll, and
drop the no-op DirectionalHorizontalScrollView.
@usamaiqb usamaiqb self-assigned this Aug 19, 2026
@usamaiqb
usamaiqb merged commit 2d67dc2 into main Aug 20, 2026
3 checks passed
@usamaiqb
usamaiqb deleted the fix/viewer-scroll-stutter branch August 20, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant