Skip to content

fix(ui): reset chat scroll to bottom when a confirm modal mounts#643

Merged
esengine merged 1 commit into
mainfrom
fix/issue-642-modal-scroll-reset
May 11, 2026
Merged

fix(ui): reset chat scroll to bottom when a confirm modal mounts#643
esengine merged 1 commit into
mainfrom
fix/issue-642-modal-scroll-reset

Conversation

@esengine

Copy link
Copy Markdown
Owner

Summary

When the user has scrolled up in the chat and a confirm modal arrives — run_command, run_background, plan_proposed, plan_checkpoint, plan_revision, or choice — the modal mounts at the bottom of the chat area, which is off-screen. The picker captures arrow keys, so scroll-down inputs no longer move the viewport either, and the user is visually stuck.

src/cli/ui/App.tsx's pauseGate.on(...) listener now calls chatScroll.jumpToBottom() once before the kind switch. That flips pinned: true; the modal's useReserveRows shrinks the chat area, which triggers setMaxScroll, which under the pinned-mode invariant snaps scrollRows to the new bottom. Single line; covers all five modal kinds.

Closes #642

Test plan

  • npm run verify — 2562 passed, 2 skipped
  • New test tests/modal-scroll-reset.test.ts:
    • Primitive: after scrollPageUp then jumpToBottom, the next setMaxScroll snaps scrollRows to the max.
    • Integration: a pauseGate listener wired to jumpToBottom reseats the viewport on every modal kind.
  • Manual repro on Win Terminal: scroll up, trigger a shell-needing command, confirm the picker becomes visible.

If the user has scrolled up in the chat history and a pauseGate request
arrives — shell command, plan proposal, plan checkpoint, plan revision,
or ask_choice — the modal mounts at the bottom of the chat area, which
is off-screen below the scroll position. The picker captures arrow
keys, so the user can't scroll back down to see the options either,
and looks stuck.

Calling chatScroll.jumpToBottom() once at the top of the pauseGate
listener flips pinned back on; the modal's useReserveRows triggers
setMaxScroll, which snaps scrollRows to the new bottom under the
existing pinned-mode invariant.

Closes #642
@esengine esengine merged commit 6f206e7 into main May 11, 2026
3 checks passed
@esengine esengine deleted the fix/issue-642-modal-scroll-reset branch May 11, 2026 05:42
ChasLui pushed a commit to ChasLui/DeepSeek-Reasonix that referenced this pull request May 23, 2026
…ngine#643)

If the user has scrolled up in the chat history and a pauseGate request
arrives — shell command, plan proposal, plan checkpoint, plan revision,
or ask_choice — the modal mounts at the bottom of the chat area, which
is off-screen below the scroll position. The picker captures arrow
keys, so the user can't scroll back down to see the options either,
and looks stuck.

Calling chatScroll.jumpToBottom() once at the top of the pauseGate
listener flips pinned back on; the modal's useReserveRows triggers
setMaxScroll, which snaps scrollRows to the new bottom under the
existing pinned-mode invariant.

Closes esengine#642
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.

Modal confirm prompts invisible when chat is scrolled up (shell / plan / checkpoint / revision / choice)

1 participant