Automatically reposition event target on focus in case browser automatically centers input fields.

This commit is contained in:
Michael Jumper
2012-04-08 16:31:11 -07:00
parent 1cdcae9281
commit f8f48f551a

View File

@@ -279,6 +279,15 @@ var GuacamoleUI = {
GuacamoleUI.buttons.touchShowKeyboard.ontouchstart = GuacamoleUI.buttons.touchShowKeyboard.ontouchstart =
GuacamoleUI.buttons.touchShowKeyboard.onclick = GuacamoleUI.buttons.touchShowKeyboard.onclick =
function(e) { 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.eventTarget.focus();
GuacamoleUI.hideTouchMenu(); GuacamoleUI.hideTouchMenu();
e.preventDefault(); e.preventDefault();