Skip to content

fix(tui): prevent sidebar scrollbar flash - #40056

Merged
kitlangton merged 1 commit into
v2from
fix-sidebar-flash
Aug 1, 2026
Merged

fix(tui): prevent sidebar scrollbar flash#40056
kitlangton merged 1 commit into
v2from
fix-sidebar-flash

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Prevent the V2 TUI sidebar scrollbar from flashing for one frame when switching session tabs. Empty sessions also stop showing the internal Not measured context placeholder and $0.00 spent.

Before / After

Before

Switching tabs remounted the keyed session view. OpenTUI created the sidebar scrollbar as visible, rendered that state, then hid it after calculating the viewport and content sizes.

Tab switch -> sidebar mounts -> scrollbar flashes -> layout measures -> scrollbar hides

A new session also showed a context section with Not measured and $0.00 spent despite having no usage.

After

The sidebar scrollbar starts hidden and returns visibility control to OpenTUI after mount. It appears only when measured content actually overflows.

Tab switch -> sidebar mounts hidden -> layout measures -> scrollbar appears only if needed

The context section remains absent until usage or cost data is meaningful.

How

  • packages/tui/src/routes/session/sidebar.tsx initializes the vertical scrollbar as hidden, then resets manual visibility control after creation so OpenTUI resumes normal overflow-driven behavior.
  • packages/tui/src/feature-plugins/sidebar/context.tsx renders context usage and cost only when either value is available.
  • packages/tui/test/feature-plugins/sidebar-context.test.tsx covers empty and populated context rendering.

Scope

This only changes the V2 TUI session sidebar. It does not change the main transcript scrollbar or web/desktop sidebars.

Testing

  • bun run test test/feature-plugins test/util/session.test.ts (26 passed)
  • bun typecheck from packages/tui
  • Full repository typecheck from the pre-push hook (33 packages passed)
  • git diff --check

Demo

The scrollbar defect exists only in the pre-measurement frame, so a settled terminal screenshot cannot capture it honestly. The before/after lifecycle above describes the visible transition; rendered-output tests cover the context-state change.

@kitlangton
kitlangton enabled auto-merge (squash) August 1, 2026 15:08
@kitlangton
kitlangton merged commit d5f6c08 into v2 Aug 1, 2026
10 checks passed
@kitlangton
kitlangton deleted the fix-sidebar-flash branch August 1, 2026 15:12
github-actions Bot pushed a commit to ReStranger/opencode that referenced this pull request Aug 3, 2026
* upstream/v2:
  test(core): stabilize shell integration timing (anomalyco#40084)
  fix(core): route Bedrock packages natively (anomalyco#40165)
  feat(ai): add native Bedrock Mantle support (anomalyco#40119)
  fix(tui): reserve home and end for navigation (anomalyco#40123)
  refactor(ai): align multimodal naming (anomalyco#40073)
  refactor(tui): remove redundant code (anomalyco#40081)
  fix(tui): discover plugins across config roots (anomalyco#39988)
  fix(tui): make vertical tabs responsive (anomalyco#40080)
  feat(tui): add vertical session tabs (anomalyco#40072)
  fix: preserve provider error status (anomalyco#39976)
  fix(tui): prevent sidebar scrollbar flash (anomalyco#40056)
  feat(tui): prioritize favorite model search results (anomalyco#40049)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant