From f8f48f551af326cc72e1bbdd4a8301f609e6996d Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 8 Apr 2012 16:31:11 -0700 Subject: [PATCH] Automatically reposition event target on focus in case browser automatically centers input fields. --- guacamole/src/main/webapp/scripts/interface.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index 3ad73fbda..67640edb2 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -279,6 +279,15 @@ var GuacamoleUI = { GuacamoleUI.buttons.touchShowKeyboard.ontouchstart = GuacamoleUI.buttons.touchShowKeyboard.onclick = function(e) { + + // Center event target in case browser automatically centers + // input fields on focus. + GuacamoleUI.eventTarget.style.left = + (window.pageXOffset + GuacamoleUI.viewport.offsetWidth / 2) + "px"; + + GuacamoleUI.eventTarget.style.top = + (window.pageYOffset + GuacamoleUI.viewport.offsetHeight / 2) + "px"; + GuacamoleUI.eventTarget.focus(); GuacamoleUI.hideTouchMenu(); e.preventDefault();