From: Michael Jumper Date: Sun, 8 Apr 2012 23:31:11 +0000 (-0700) Subject: Automatically reposition event target on focus in case browser automatically centers... X-Git-Url: http://git.alex.org.uk Automatically reposition event target on focus in case browser automatically centers input fields. --- 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();