[PR #724] [MERGED] scrollbox: add scrollChildIntoView method #1517

Closed
opened 2026-03-14 09:41:08 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/724
Author: @simonklee
Created: 2/21/2026
Status: Merged
Merged: 3/13/2026
Merged by: @simonklee

Base: mainHead: scroll-into-view


📝 Commits (1)

  • 1f3fa05 scrollbox: add scrollChildIntoView method

📊 Changes

2 files changed (+200 additions, -0 deletions)

View changed files

📝 packages/core/src/renderables/ScrollBox.ts (+49 -0)
📝 packages/core/src/tests/scrollbox.test.ts (+151 -0)

📄 Description

Add a convenience API to keep a descendant visible without repeated
call-site math around viewport bounds and scroll deltas.

Use nearest alignment on both axes instead of DOM's default
block:start so keyboard navigation moves as little as possible.
Mirror CSSOM View nearest behavior for oversized children, including
no-op when an oversized child already intersects the viewport, to
avoid jumpy scrolling.

See https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview

Fixes #716


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/724 **Author:** [@simonklee](https://github.com/simonklee) **Created:** 2/21/2026 **Status:** ✅ Merged **Merged:** 3/13/2026 **Merged by:** [@simonklee](https://github.com/simonklee) **Base:** `main` ← **Head:** `scroll-into-view` --- ### 📝 Commits (1) - [`1f3fa05`](https://github.com/anomalyco/opentui/commit/1f3fa0598c7caa61a1ad151f105d17c3fbc46573) scrollbox: add scrollChildIntoView method ### 📊 Changes **2 files changed** (+200 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/renderables/ScrollBox.ts` (+49 -0) 📝 `packages/core/src/tests/scrollbox.test.ts` (+151 -0) </details> ### 📄 Description Add a convenience API to keep a descendant visible without repeated call-site math around viewport bounds and scroll deltas. Use nearest alignment on both axes instead of DOM's default block:start so keyboard navigation moves as little as possible. Mirror CSSOM View nearest behavior for oversized children, including no-op when an oversized child already intersects the viewport, to avoid jumpy scrolling. See https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview Fixes #716 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 09:41:08 +03:00
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#1517
No description provided.