Skip to content

fix(scrollview): honor padded viewport - #22

Open
cdd1037 wants to merge 1 commit into
ghboke:mainfrom
cdd1037:codex/fix-scrollview-padded-viewport
Open

cdd1037 wants to merge 1 commit into
ghboke:mainfrom
cdd1037:codex/fix-scrollview-padded-viewport

Conversation

@cdd1037

@cdd1037 cdd1037 commented Aug 23, 2026

Copy link
Copy Markdown

Summary

  • define one padding-aware inner viewport for ScrollView layout, scrolling, thumb geometry, and hit testing
  • clip scrolled content to that inner viewport so it cannot paint into the padding area
  • draw the overlay scrollbar after content so opaque children cannot cover it
  • add a regression test for padded viewport overflow and maximum scroll range

Bug

DoLayout() subtracted padding, while VisibleHeight(), clamping, and thumb calculations still used the outer widget height. A 100 px ScrollView with 10 px top/bottom padding therefore treated its viewport as 100 px instead of 80 px. Content near that boundary could fail to show a scrollbar or could not be scrolled fully into view.

The scrollbar was also painted before the child tree, despite being an overlay, so opaque content could cover it.

Validation

The regression test uses a 100 px outer height, 10 px vertical padding on both sides, and 90 px content. It verifies that a scrollbar is required and the maximum scroll offset is 10 px. The test and optimized Windows x64 build pass under clang-cl.

Build: https://github.com/cdd1037/core-ui/actions/runs/32629855670

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