feat(browser): visible vertical + horizontal content scrollbars - #173
Merged
Conversation
The Browser widget scrolled the page vertically by wheel only: it drew no scrollbar on either axis, and horizontal overflow (a zoomed page wider than the content column) was clipped with no way to reach it. Consumers (the go-news-reader web preview) showed no scroll affordance and no horizontal reach. Add both content scrollbars, reusing the toolkit's shared scrollDrag / sbGeom policy (the same primitives ScrollView and Table use), so a thumb drag behaves identically to every other scrollable widget: - Vertical bar on the content's right edge whenever the page overflows vertically; horizontal bar on the bottom edge under horizontal overflow (zoom > 1). Each is a SurfaceAlt track with an Accent thumb sized to the visible fraction; one vscrollGeom/hscrollGeom definition drives both the paint and the hit-test so the drawn thumb and the drag target never drift. - New per-tab scrollX; drawPage paints the display window [scrollX, scrollX+cr.W) instead of clipping at column 0. clampScroll re-pins both offsets on every mutation (wheel, thumb drag, track page, zoom); Deliver resets both; SetZoom re-clamps both; shift-wheel scrolls horizontally. - Both bars shorten by scrollbarWidth when both show, leaving the corner clear; linkAt accounts for scroll AND scrollX; a press on either bar is consumed so it never falls through to a page link. Tests: draw geometry + thumb tracking at scroll 0/max, thumb drag and track paging on both axes, horizontal-only-under-zoom, corner reserve, link hit-test with both offsets, Deliver/zoom reclamp, shift-wheel, negative clamp, degenerate tiny-track floor/clamp, and no-active-tab guards. 100% statement coverage; cross-builds on all 6 arches. Co-Authored-By: Claude Opus 4.8 <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.
Problem
The
Browserwidget (used by the go-news-reader web preview) scrolled the page vertically by wheel only: it drew no scrollbar on either axis, and horizontal overflow (a zoomed page wider than the content column) was clipped with no way to reach it. The preview showed no scroll affordance and no horizontal reach.Changes
Both content scrollbars, reusing the toolkit's shared
scrollDrag/sbGeompolicy (the same primitivesScrollViewandTableuse), so a thumb drag behaves identically to every other scrollable widget:vscrollGeom/hscrollGeomdefinition drives both paint and hit-test, so the drawn thumb and the drag target are one geometry.scrollX;drawPagepaints the display window[scrollX, scrollX+cr.W)instead of clipping at column 0.clampScrollre-pins both offsets on every mutation (wheel, thumb drag, track page, zoom);Deliverresets both;SetZoomre-clamps both; shift-wheel scrolls horizontally.scrollbarWidthso the corner stays clear;linkAtaccounts forscrollandscrollX; a press on either bar is consumed (never falls through to a page link).Tests
Draw geometry + thumb tracking at scroll 0/max, thumb drag + track paging on both axes, horizontal-only-under-zoom, corner reserve, link hit-test with both offsets,
Deliver/zoom reclamp, shift-wheel, negative clamp, degenerate tiny-track floor/clamp, no-active-tab guards. 100% statement coverage; cross-builds on all 6 arches + darwin/windows.Local
mainis at8ded916(#172); tag a release after merge so the reader can bump.🤖 Generated with Claude Code