Fix iOS keyboard dismissal - don't steal focus with terminal.focus()

This commit is contained in:
GitHub Copilot
2026-01-28 07:49:22 +00:00
parent 63c49f385f
commit fb2bc46ecb
2 changed files with 10 additions and 15 deletions
File diff suppressed because one or more lines are too long
+5 -10
View File
@@ -454,24 +454,19 @@ class WebTerminal {
// Focus textarea on touch/click to show mobile keyboard
// iOS requires focus() to be called synchronously within the gesture
this.element.addEventListener("touchend", (e) => {
// Only respond to single touch on terminal area
if (e.target === textarea || e.target === this.element || this.element.contains(e.target as Node)) {
// Don't call terminal.focus() as it steals focus and dismisses keyboard
const focusTextarea = () => {
this.mobileInput?.focus();
}
}, { passive: true });
};
this.element.addEventListener("click", () => {
this.mobileInput?.focus();
this.terminal.focus();
});
this.element.addEventListener("touchend", focusTextarea, { passive: true });
this.element.addEventListener("click", focusTextarea);
}
/** Focus the mobile input to show keyboard */
private focusMobileInput(): void {
// For programmatic focus (not from user gesture), this may not show keyboard on iOS
this.mobileInput?.focus();
this.terminal.focus();
}
/** Wait for fonts to be loaded */