[PR #6] [MERGED] fix: handle physical keyboard special keys in terminal #3

Closed
opened 2026-02-28 00:49:05 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Termix-SSH/Mobile/pull/6
Author: @ZacharyZcR
Created: 2/12/2026
Status: Merged
Merged: 2/14/2026
Merged by: @LukeGus

Base: dev-1.3.0Head: fix/physical-tab-key


📝 Commits (4)

  • 8d2709d feat: add iPadOS build workflow without EAS dependency (#4)
  • 3bd4c39 fix: handle physical keyboard special keys in terminal
  • f2f2068 feat: add iOS native Shift+Tab support via UIKeyCommand
  • 73d38e2 Merge branch 'dev-1.3.0' into fix/physical-tab-key

📊 Changes

5 files changed (+202 additions, -1 deletions)

View changed files

.github/workflows/build-ipados.yml (+75 -0)
📝 app/tabs/sessions/Sessions.tsx (+31 -1)
modules/hardware-keyboard/expo-module.config.json (+6 -0)
modules/hardware-keyboard/index.ts (+23 -0)
modules/hardware-keyboard/ios/HardwareKeyboardModule.swift (+67 -0)

📄 Description

Summary

  • Physical keyboard Tab, Escape, and arrow keys were silently dropped by the key.length === 1 filter in onKeyPress
  • These named keys (e.g. "Tab", "Escape", "ArrowUp") have length > 1 and were not explicitly handled like Enter/Backspace
  • Add explicit handlers: Tab → \t, Escape → \x1b, arrows → standard escape sequences
  • Add iOS native UIKeyCommand module to intercept Shift+Tab on hardware keyboards and forward \x1b[Z (backtab) to the terminal

iOS Native Module (modules/hardware-keyboard)

  • Expo native module using UIKeyCommand with wantsPriorityOverSystemBehavior to capture Shift+Tab before the system handles it
  • Method swizzling on UIViewController.keyCommands to inject the key command globally
  • Events bridge to JS via Expo's EventEmitter pattern

Test plan

  • Connect a physical keyboard to iOS device/simulator
  • Open a terminal session (e.g. with claude CLI)
  • Press Tab → sends \t (tab completion)
  • Press Shift+Tab → sends \x1b[Z (backtab / reverse tab)
  • Press Escape → sends \x1b
  • Press arrow keys → cursor navigation works

Relates to Termix-SSH/Support#355


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Termix-SSH/Mobile/pull/6 **Author:** [@ZacharyZcR](https://github.com/ZacharyZcR) **Created:** 2/12/2026 **Status:** ✅ Merged **Merged:** 2/14/2026 **Merged by:** [@LukeGus](https://github.com/LukeGus) **Base:** `dev-1.3.0` ← **Head:** `fix/physical-tab-key` --- ### 📝 Commits (4) - [`8d2709d`](https://github.com/Termix-SSH/Mobile/commit/8d2709d46bf6fdc63fd8e153c5d6aeecfba73995) feat: add iPadOS build workflow without EAS dependency (#4) - [`3bd4c39`](https://github.com/Termix-SSH/Mobile/commit/3bd4c39f0756c72226d61009315c622f8f267d32) fix: handle physical keyboard special keys in terminal - [`f2f2068`](https://github.com/Termix-SSH/Mobile/commit/f2f206892f098f31c58cf65439e74017ffbcb6a3) feat: add iOS native Shift+Tab support via UIKeyCommand - [`73d38e2`](https://github.com/Termix-SSH/Mobile/commit/73d38e28ea9f434dacc67edfe5d465e33805a8b8) Merge branch 'dev-1.3.0' into fix/physical-tab-key ### 📊 Changes **5 files changed** (+202 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/build-ipados.yml` (+75 -0) 📝 `app/tabs/sessions/Sessions.tsx` (+31 -1) ➕ `modules/hardware-keyboard/expo-module.config.json` (+6 -0) ➕ `modules/hardware-keyboard/index.ts` (+23 -0) ➕ `modules/hardware-keyboard/ios/HardwareKeyboardModule.swift` (+67 -0) </details> ### 📄 Description ## Summary - Physical keyboard Tab, Escape, and arrow keys were silently dropped by the `key.length === 1` filter in `onKeyPress` - These named keys (e.g. `"Tab"`, `"Escape"`, `"ArrowUp"`) have length > 1 and were not explicitly handled like Enter/Backspace - Add explicit handlers: Tab → `\t`, Escape → `\x1b`, arrows → standard escape sequences - Add iOS native `UIKeyCommand` module to intercept Shift+Tab on hardware keyboards and forward `\x1b[Z` (backtab) to the terminal ## iOS Native Module (`modules/hardware-keyboard`) - Expo native module using `UIKeyCommand` with `wantsPriorityOverSystemBehavior` to capture Shift+Tab before the system handles it - Method swizzling on `UIViewController.keyCommands` to inject the key command globally - Events bridge to JS via Expo's `EventEmitter` pattern ## Test plan - [ ] Connect a physical keyboard to iOS device/simulator - [ ] Open a terminal session (e.g. with `claude` CLI) - [ ] Press Tab → sends `\t` (tab completion) - [ ] Press Shift+Tab → sends `\x1b[Z` (backtab / reverse tab) - [ ] Press Escape → sends `\x1b` - [ ] Press arrow keys → cursor navigation works Relates to Termix-SSH/Support#355 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem closed this issue 2026-02-28 00:49:11 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Mobile#3
No description provided.