From 2b3c41fa6e4fa3a41edaee5ed325601a92c51bd8 Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Wed, 25 Jun 2025 18:51:43 +0200 Subject: [PATCH] keyboard focus: blur/focus toggle --- com/isoterminal.js | 8 ++++++++ com/isoterminal/term.js | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/com/isoterminal.js b/com/isoterminal.js index 403ddd5..4744245 100644 --- a/com/isoterminal.js +++ b/com/isoterminal.js @@ -390,6 +390,14 @@ if( typeof AFRAME != 'undefined '){ const focus = (e) => { + if( event.target == document.activeElement ){ + // if we're already focused, the keyboard is already triggerend + // therefore we blur() the element for correctness + // which allows the WebXR keyboard dissappear if implemented at all + // [Meta Quest 2 does not do this] + event.target.blur() + } + // calculate distance between thumb and indexfinger to detect pinch // which should prevent focus-event (annoying to have keyboard popping up during pinch) if( e.detail?.withEl?.components['hand-tracking-controls'] ){ diff --git a/com/isoterminal/term.js b/com/isoterminal/term.js index d0fc3a2..0af741f 100644 --- a/com/isoterminal/term.js +++ b/com/isoterminal/term.js @@ -1259,7 +1259,6 @@ Term.prototype.blurHandler = function (ev) Term.prototype.pasteHandler = function (ev) { - debugger var c, str; if (!this.textarea_has_focus) { c = ev.clipboardData;