fix: mobile terminal scroll in both normal mode and tmux

- Dual-mode touch scroll:
  - Normal mode: scroll .xterm-viewport directly when scrollHeight > clientHeight
  - Alternate screen (tmux/vim): send SGR 1006 mouse-wheel protocol data
    using cursor position so tmux knows which pane to scroll
- Add touch-action: none to .terminal-container to prevent browser gestures
- Lock both html and body overflow when terminal page is open on mobile
- Remove synthetic WheelEvent approach (xterm.js SmoothScrollableElement
  doesn't reliably handle synthetic events)
This commit is contained in:
Alex Blank
2026-05-29 20:35:28 +02:00
parent 98b9d612fa
commit 4814ec2363
3 changed files with 34 additions and 8 deletions
+3 -1
View File
@@ -204,12 +204,14 @@ export const TerminalPage: React.FC = () => {
};
}, []);
// Lock body scroll on mobile terminal so swipes scroll the terminal buffer,
// Lock page scroll on mobile terminal so swipes scroll the terminal buffer,
// not the page.
useEffect(() => {
if (!isMobile) return;
document.documentElement.classList.add("terminal-page-open");
document.body.classList.add("terminal-page-open");
return () => {
document.documentElement.classList.remove("terminal-page-open");
document.body.classList.remove("terminal-page-open");
};
}, [isMobile]);