fix: handle terminal keyboard input on Android tablet (#1133)

* fix: handle terminal keyboard input on Android with desktop UA

- Detect Android via navigator.userAgentData.platform when UA is
  spoofed by Chrome's "Desktop site" mode, so the <input> overlay
  (useTextInput) is used instead of <textarea>.
- Handle Ctrl+letter and Alt+letter combos in the hidden input
  overlay's keydown handler, so terminal control sequences (^C, ^D,
  ^S, M-x, etc.) work through the touch input path.
- Skip global keyboard shortcuts (sidebar toggle, etc.) when focus
  is inside the terminal viewport, preventing shortcut steal.

* fix: preserve terminal keyboard shortcuts

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Junlang Huang
2026-05-07 23:27:37 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent d5b3590901
commit b65edc3436
2 changed files with 27 additions and 2 deletions
@@ -64,7 +64,6 @@ export const useKeyboardShortcuts = () => {
target.getAttribute('data-terminal-hidden-input') === 'true'
);
};
const handleTerminalShortcutCapture = (e: KeyboardEvent) => {
if (!isTerminalEventTarget(e.target)) {
return;
@@ -94,6 +93,10 @@ export const useKeyboardShortcuts = () => {
};
const handleKeyDown = (e: KeyboardEvent) => {
if (isTerminalEventTarget(e.target)) {
return;
}
if (eventMatchesShortcut(e, combo('open_command_palette'))) {
e.preventDefault();
toggleCommandPalette();