Skip to content

feat(terminal): add a jump-to-bottom button while scrolled up in history - #1036

Merged
devswha merged 2 commits into
devswha:mainfrom
m16khb:feat/terminal-jump-to-bottom
Oct 14, 2026
Merged

devswha merged 2 commits into
devswha:mainfrom
m16khb:feat/terminal-jump-to-bottom

Conversation

@m16khb

@m16khb m16khb commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Change

Closes #1034

In the Terminal lens, scrolling herdr's shared history up leaves the pane with no one-tap way back to the live bottom: the history scrollbar's End key is the only shortcut, and it is out of reach on a phone. Chat already has a round "Jump to latest" button for this.

While herdr reports offset_from_bottom > 0 and the pane is interactive, a round ArrowDown "Jump to bottom" button now floats over the grid's bottom-right corner, left of the history gutter. Tapping it sends the same pane.scroll offset 0 as the scrollbar's End key, through the existing coalesced writeRef path in TerminalViewportTools. A failed write falls back to the existing Scroll failed error. The button:

  • is hidden at the bottom, in the chat lens, in observe and read-only views, and while Find owns the viewport (it renders only when enabled && interactive);
  • keeps focus in the terminal (and the soft keyboard up) via onPointerDown preventDefault, the same pattern as the input row's buttons;
  • reuses the Chat button's round form with tokens only (--control-h, --touch-target on coarse pointers, --radius-pill, --shadow-pop, --icon-size), no color literals, no new animation;
  • is anchored to the grid's bottom-right corner clipped to the mount's client area, so an adopted grid (a mirrored PC, an observer) that is wider than the mount keeps the button inside the overlay instead of under the gutter.

No new state, polling, endpoint, WS frame or protocol type; site/demo/transport.ts already answers pane/scroll. New string Jump to bottom is translated in ko, ja, zh and tr. DESIGN.md (terminal history section) and a changelog.d fragment are updated.

Heads-up: #945 (phone scrollbar toggle) also edits TerminalViewportTools.tsx and DESIGN.md. There is no functional dependency, only a possible textual conflict.

Validation

  • bun run check fast: generated types fresh, typecheck, build and unit tests (3470 pass, 0 fail, includes i18n.test.ts, conventions.test.ts, motion.test.ts).
  • scripts/terminal-viewport-regression.ts gains a step: no button at the native bottom, button visible after Home and left of the gutter, with the terminal textarea focused a click returns herdr to offset 0, the button detaches, focus stays on the textarea and no input frame is sent.
    • On my macOS machine (herdr 0.9.3) the script already stops at the existing step "repeat paging accumulates against the pending preview", identically on untouched main, so I could not run it end to end here. With that one block removed in a throwaway copy the whole script, including the new step, prints PASS native history scrollbar, .... Please rely on the CI browser lane for the full script.
  • One-off Playwright check (not committed): 390x844 viewport with a coarse pointer, on an attached pane and on a mirror pane (createServer({ terminalAttach: false }), adopted grid). In both the button is 40x40, inside the mount's client area and left of the gutter.
  • Not verified: a real iOS or Android soft keyboard (only Playwright mouse and touch emulation), and an adopted grid that is actually wider than the mount (covered by code reading and the clip logic only).

When herdr's shared history viewport is above the bottom and the pane is
interactive, the terminal lens shows a round ArrowDown button over the
grid's bottom-right corner, left of the history gutter. It sends the same
pane.scroll offset 0 as the scrollbar's End key, keeps focus in the
terminal, and uses the Chat lens' round button form with design tokens
(--touch-target on coarse pointers).

The anchor is clipped to the mount's client area so an adopted grid
(a mirrored PC, an observer) that is wider than the mount keeps the button
inside the overlay.

Closes devswha#1034
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e56f9850-1956-41a6-ac28-82e80765de2e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 69e8a188-00cf-4874-b249-100bc0ade5b2
📥 Commits

Reviewing files that changed from the base of the PR and between d5dd7a6 and 37347f8.

📒 Files selected for processing: 9
  • DESIGN.md
  • changelog.d/terminal-jump-to-bottom.md
  • scripts/terminal-viewport-regression.ts
  • src/components/TerminalViewportTools.css
  • src/components/TerminalViewportTools.tsx
  • src/lib/i18n.ja.ts
  • src/lib/i18n.ko.ts
  • src/lib/i18n.tr.ts
  • src/lib/i18n.zh.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Added a “Jump to bottom” button when you’ve scrolled up in an interactive terminal. Select it to return to the latest output without moving focus from the terminal.
  • Accessibility
    • Added translated button labels in Japanese, Korean, Turkish, and Simplified Chinese.

Adds a floating “Jump to bottom” button to terminal viewport tools. The button appears when the pane is scrolled up and the tools are interactive. Activating it requests scroll offset 0. Styling, translations, regression checks, and documentation are included.

Changes: Terminal Jump-to-Bottom Control

Layer / File(s) Summary
Position and activate the jump button
src/components/TerminalViewportTools.tsx, src/components/TerminalViewportTools.css, src/lib/i18n.{ja,ko,tr,zh}.ts, scripts/terminal-viewport-regression.ts, DESIGN.md, changelog.d/terminal-jump-to-bottom.md
The viewport tools calculate button anchors from the visible mount bounds and render the button when the tools are enabled, the track has height, and the scroll offset is above zero. Activation requests offset 0. Styles, four translations, browser regression checks, design documentation, and a changelog entry cover the control.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Medium

Suggested reviewers: devswha

Merge Risk: ⚪ Minimal · up to 37347

The jump-to-bottom control provides a quick return to the live terminal view and is hidden while Find owns the viewport. No actionable merge risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 6 files. (3 skipped: 3 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding a terminal jump-to-bottom button while the user is scrolled in history.
Description check Passed The description includes the required Change and Validation sections. It explains the behavior, scope, implementation, translations, test results, known validation limitation, and unverified platform …
Linked Issues check Passed The PR implements the coding requirements in #1034. TerminalViewportTools renders the button only for an enabled, interactive viewport with scrollback above offset 0. It writes offset 0 through the …
Out of Scope Changes check Passed The changed component, CSS, regression coverage, translations, design documentation, and changelog fragment all support the #1034 feature. The changes add no new endpoint, protocol type, transport pat…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 6 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@m16khb
m16khb marked this pull request as ready for review October 14, 2026 09:22
Main removed the terminal history scrollbar (devswha#1113): anchor the jump button to the grid's
bottom-right corner without the gutter, drop the scrollbar's aria-controls, page up with the
shortcut in the regression step, and update DESIGN.md and the changelog fragment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@devswha

devswha commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Thanks @m16khb! Main removed the terminal history scrollbar in #1113 after this branch was cut, so I pushed a merge of main (c11817f) that rebuilds the button on top of it:

  • the button anchors to the grid's bottom-right corner (no gutter, no trackHeight, no aria-controls to the removed scrollbar);
  • the regression step pages up with Mod+Shift+PageUp instead of the scrollbar's Home key, and checks the button sits inside the grid's corner;
  • DESIGN.md and the changelog fragment no longer mention the scrollbar's End key; the tr entry went with i18n.tr.ts, which main removed.

With the scrollbar gone this button is now the one-tap way back to the live bottom on a phone, so it's a welcome addition. scripts/terminal-viewport-regression.ts passes locally on the merge; CI is running.

@devswha
devswha merged commit 27f945a into devswha:main Oct 14, 2026
9 checks passed
devswha added a commit that referenced this pull request Nov 5, 2026
…kept history (#2859)

## What

The terminal's round "Jump to bottom" button (#1036) only read herdr's
viewport metrics (`pane.scroll`). On a herdr-core server
(`terminal-history`, the desktop app's runtime) nothing on the server
scrolls: xterm keeps the replayed history itself, the wheel and a swipe
scroll it locally, and herdr-core reports no scroll metrics. So the
button never appeared there, and the only way back to the newest output
was to wheel or swipe all the way down.

Now `TerminalViewportTools` also follows xterm's own viewport
(`buffer.viewportY < buffer.baseY`, read on `onScroll` and `onRender`):

- While xterm's view is above its bottom, the same button shows, at the
same corner and in the same form. Clicking it calls
`terminal.scrollToBottom()`; herdr's shared viewport is only written
when herdr's metrics say it is scrolled (unchanged behaviour on a herdr
server).
- The local case shows in read-only views too: that scroll belongs to
this browser alone and moves nothing for other clients. herdr's case
keeps its `interactive` gate.
- Pressed from the keyboard (Tab, Enter), the button hands focus back to
the terminal instead of leaving it on a button that disappears. A
pointer press still never moves focus.
- On a herdr server xterm keeps `scrollback: 0`, so `baseY` stays 0 and
nothing changes there.

Design follows VS Code's integrated terminal, whose history scrolls
locally and returns to the bottom on demand; the button keeps the
existing chat-lens round form (DESIGN.md entry updated).

## Screenshots (herdr-core server, scrolled up in history)

| 1280 | 390 |
|---|---|
| <img
src="https://raw.githubusercontent.com/devswha/ovis/68a7b958830933f5346f4f824828ebbc67600780/jump-bottom-1280.png"
width="640"> | <img
src="https://raw.githubusercontent.com/devswha/ovis/68a7b958830933f5346f4f824828ebbc67600780/jump-bottom-390.png"
width="260"> |

## Validation

- `scripts/core-history-scroll-demo-regression.ts` gains the button
checks (appears after a wheel up, click returns to `viewportY === baseY`
and the button goes, Enter on the focused button does the same). On
origin/main it fails waiting for `.terminal-jump-bottom`; on this branch
both cases pass (`PASS core`, `PASS herdr`).
- `bun run check fast`: passed (typecheck, build, 11427 unit tests,
generated files, workflow syntax).
- Skipped: `bun run check full` (left to CI's Integration and browser
job).
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.

Terminal: a floating button back to the bottom while history is scrolled up

2 participants