Skip to content

Web UI: terminal scroll buttons no longer steal xterm focus#280

Merged
edwin-zvs merged 2 commits into
mainfrom
webui-scroll-buttons-no-focus
May 30, 2026
Merged

Web UI: terminal scroll buttons no longer steal xterm focus#280
edwin-zvs merged 2 commits into
mainfrom
webui-scroll-buttons-no-focus

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Problem

The terminal top / bottom scroll buttons called state.term.focus() after scrolling (initTerminalScrollButtons, index.html). On mobile, focusing xterm focuses its helper textarea, which summons the soft keyboard — so tapping a scroll button just to read scrollback popped the keyboard up over the content.

Fix

  • Remove the explicit state.term.focus() from both the top and bottom click handlers.
  • preventDefault the buttons' mousedown so the button doesn't grab focus from xterm on press either.

Net effect: the scroll buttons only scroll and leave xterm's focus state exactly as it was — focused stays focused, unfocused stays unfocused — so no keyboard appears while scrolling. The existing stop(ev) (stopPropagation) already prevents the click from reaching the terminal's tap-to-focus handler, so there's no secondary focus path. Intentionally tapping the terminal body still focuses it / raises the keyboard as before.

Test

Verified on mobile: top/bottom scroll with the keyboard staying down; tapping the terminal body still focuses it.

🤖 Generated with Claude Code

edwin-zvs and others added 2 commits May 30, 2026 15:21
The top/bottom terminal scroll buttons called `state.term.focus()` after
scrolling, which focuses xterm's helper textarea and summons the mobile
soft keyboard whenever you tapped them just to read scrollback.

Drop the `focus()` calls, and `preventDefault` the buttons' `mousedown`
so they don't take focus themselves either. Scrolling now leaves xterm's
focus state untouched — focused stays focused, unfocused stays unfocused —
so no keyboard pops up while reading scrollback. The existing
`stopPropagation` already blocks the terminal's tap-to-focus handler, so
there's no secondary focus path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update the assertion to match the fix in this branch: the terminal
top/bottom scroll buttons no longer call term.focus() (which summoned
the mobile soft keyboard), so the expected call sequence is now
["top", "bottom"] instead of ["top", "focus", "bottom", "focus"].

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@edwin-zvs
edwin-zvs merged commit a0b06a3 into main May 30, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the webui-scroll-buttons-no-focus branch May 30, 2026 22:30
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.

1 participant