From eee56d7acfafe7b34fa3e1a826d283ee772c40bc Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Wed, 13 May 2026 03:34:41 +0800 Subject: [PATCH] fix: register physical Tab key on iPadOS/iOS hardware keyboards The native module only registered Shift+Tab but not bare Tab, so iOS intercepted it for UI focus navigation. Register an unmodified Tab UIKeyCommand with wantsPriorityOverSystemBehavior and handle both Tab and Shift+Tab in the same JS branch. Fixes Termix-SSH/Support#557 --- app/tabs/sessions/Sessions.tsx | 4 ++-- modules/hardware-keyboard/ios/HardwareKeyboardModule.swift | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/tabs/sessions/Sessions.tsx b/app/tabs/sessions/Sessions.tsx index e679592..6b3a174 100644 --- a/app/tabs/sessions/Sessions.tsx +++ b/app/tabs/sessions/Sessions.tsx @@ -395,8 +395,8 @@ export default function Sessions() { : null; if (!activeRef?.current) return; - if (event.shift && event.input === "\t") { - activeRef.current.sendInput("\x1b[Z"); + if (event.input === "\t") { + activeRef.current.sendInput(event.shift ? "\x1b[Z" : "\t"); return; } diff --git a/modules/hardware-keyboard/ios/HardwareKeyboardModule.swift b/modules/hardware-keyboard/ios/HardwareKeyboardModule.swift index 89c664c..31df194 100644 --- a/modules/hardware-keyboard/ios/HardwareKeyboardModule.swift +++ b/modules/hardware-keyboard/ios/HardwareKeyboardModule.swift @@ -73,6 +73,11 @@ extension UIViewController { rightCmd.wantsPriorityOverSystemBehavior = true commands.append(rightCmd) + // Tab (unmodified) + let tab = UIKeyCommand(input: "\t", modifierFlags: [], action: #selector(hk_handleTab)) + tab.wantsPriorityOverSystemBehavior = true + commands.append(tab) + // Escape let esc = UIKeyCommand(input: UIKeyCommand.inputEscape, modifierFlags: [], action: #selector(hk_handleEscape)) esc.wantsPriorityOverSystemBehavior = true @@ -92,6 +97,7 @@ extension UIViewController { return commands } + @objc func hk_handleTab() { HardwareKeyboardModule.emitToAll("\t", shift: false) } @objc func hk_handleShiftTab() { HardwareKeyboardModule.emitToAll("\t", shift: true) } @objc func hk_handleArrowUp() { HardwareKeyboardModule.emitToAll("ArrowUp", shift: false) } @objc func hk_handleArrowDown() { HardwareKeyboardModule.emitToAll("ArrowDown", shift: false) }