fix(core): use scroll-offset-based scrollbar positioning in TUI#34689
Merged
AgentEnder merged 1 commit intonrwl:masterfrom Mar 21, 2026
Merged
fix(core): use scroll-offset-based scrollbar positioning in TUI#34689AgentEnder merged 1 commit intonrwl:masterfrom
AgentEnder merged 1 commit intonrwl:masterfrom
Conversation
✅ Deploy Preview for nx-docs canceled.
|
✅ Deploy Preview for nx-dev canceled.
|
969c1c4 to
efcfb6f
Compare
Contributor
|
View your CI Pipeline Execution ↗ for commit e28d373
☁️ Nx Cloud last updated this comment at |
feebf95 to
3cd9e88
Compare
The scrollbar was driven by selected_task_index, which reflects where the selection is among tasks rather than the viewport's scroll position. This caused the scrollbar thumb to appear offset even when at the top of the list (scroll_offset=0), because the selected task might not be the first visible one. Switch to scroll-offset-based metrics (total_entries, viewport_height, scroll_offset) so the scrollbar accurately represents which portion of the entry list is currently in view. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019cb8f0-af3f-77bb-82b6-5d8a296655a7
3cd9e88 to
e28d373
Compare
AgentEnder
approved these changes
Mar 21, 2026
FrozenPandaz
pushed a commit
that referenced
this pull request
Mar 26, 2026
## Current Behavior The TUI sidebar scrollbar thumb position is driven by the selected task's index among tasks (`selected_task_index`). This means the scrollbar can appear offset from the top even when `scroll_offset=0` (i.e., the viewport is showing the very beginning of the list), because the selected task might not be the first one. This makes it look like there is content above that cannot be scrolled to. <img width="1165" height="833" alt="Screenshot 2026-03-03 at 8 53 00 PM" src="https://github.com/user-attachments/assets/43c695ad-c4a8-40c9-85b0-7677a8b83d12" /> Here, it looks scrolled down...but actually all the content is in view. ## Expected Behavior The scrollbar should accurately represent which portion of the entry list is currently in view. When at the top of the list (`scroll_offset=0`), the thumb should be at the top. When scrolled to the bottom, the thumb should be at the bottom. ## Related Issue(s) N/A (discovered via visual inspection) ## Details Switch the scrollbar from selection-based metrics to scroll-offset-based metrics: - `content_length` = total entries (including spacer rows) - `viewport_content_length` = viewport height - `position` = scroll offset This ensures the scrollbar reflects the actual viewport position rather than the selected task's position within the task list. Also adds `total_entries` and `viewport_height` fields to `ScrollMetrics` to make these values available without additional lock acquisitions. Co-authored-by: Amp <amp@ampcode.com> (cherry picked from commit 79bbe1b)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Current Behavior
The TUI sidebar scrollbar thumb position is driven by the selected task's index among tasks (
selected_task_index). This means the scrollbar can appear offset from the top even whenscroll_offset=0(i.e., the viewport is showing the very beginning of the list), because the selected task might not be the first one. This makes it look like there is content above that cannot be scrolled to.Here, it looks scrolled down...but actually all the content is in view.
Expected Behavior
The scrollbar should accurately represent which portion of the entry list is currently in view. When at the top of the list (
scroll_offset=0), the thumb should be at the top. When scrolled to the bottom, the thumb should be at the bottom.Related Issue(s)
N/A (discovered via visual inspection)
Details
Switch the scrollbar from selection-based metrics to scroll-offset-based metrics:
content_length= total entries (including spacer rows)viewport_content_length= viewport heightposition= scroll offsetThis ensures the scrollbar reflects the actual viewport position rather than the selected task's position within the task list.
Also adds
total_entriesandviewport_heightfields toScrollMetricsto make these values available without additional lock acquisitions.