[GH-ISSUE #716] Add scrollChildIntoView method to ScrollBoxRenderable #195

Open
opened 2026-03-02 23:45:11 +03:00 by kerem · 1 comment
Owner

Originally created by @jorgeraad on GitHub (Feb 19, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/716

Originally assigned to: @simonklee on GitHub.

ScrollBoxRenderable has scrollTo and scrollBy for position-based scrolling, but no way to say "make this child visible." Consumers end up writing the same ~15 lines of boilerplate every time they have a keyboard-navigable list inside a scrollbox: find the child by ID, calculate its position relative to the viewport, and scrollBy the right delta.

scrollBox.scrollChildIntoView(childId: string)

The class already has everything it needs internally (findDescendantById, viewport.height, scrollTop, scrollBy), so this would be a thin convenience method on the same level as scrollTo/scrollBy.

Originally created by @jorgeraad on GitHub (Feb 19, 2026). Original GitHub issue: https://github.com/anomalyco/opentui/issues/716 Originally assigned to: @simonklee on GitHub. ScrollBoxRenderable has `scrollTo` and `scrollBy` for position-based scrolling, but no way to say "make this child visible." Consumers end up writing the same ~15 lines of boilerplate every time they have a keyboard-navigable list inside a scrollbox: find the child by ID, calculate its position relative to the viewport, and `scrollBy` the right delta. ```ts scrollBox.scrollChildIntoView(childId: string) ``` The class already has everything it needs internally (`findDescendantById`, `viewport.height`, `scrollTop`, `scrollBy`), so this would be a thin convenience method on the same level as `scrollTo`/`scrollBy`.
Author
Owner

@simonklee commented on GitHub (Feb 21, 2026):

Thanks, i think the poc impl was mostly correct. I adjusted it a little and created a PR.

<!-- gh-comment-id:3938832561 --> @simonklee commented on GitHub (Feb 21, 2026): Thanks, i think the poc impl was mostly correct. I adjusted it a little and created a PR.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#195
No description provided.