From 52e5aea6233803fecff2624c810f87f32da9f7cc 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. --- src/main/webapp/scripts/interface.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/webapp/scripts/interface.js b/src/main/webapp/scripts/interface.js index 3ad73fb..67640ed 100644 --- a/src/main/webapp/scripts/interface.js +++ b/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(); -- 1.7.10.4