From 950904f59a9057f1b9211708911e3de08f2afdcf Mon Sep 17 00:00:00 2001 From: temporaryaccount Date: Thu, 19 Jul 2012 18:08:30 +0400 Subject: [PATCH] Prevent KeyboardDefaults.js from triggering keyboard events when user is typing into the form elements --- lib/OpenLayers/Control/KeyboardDefaults.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/OpenLayers/Control/KeyboardDefaults.js b/lib/OpenLayers/Control/KeyboardDefaults.js index b973b3d6bf..8b1d4e17a3 100644 --- a/lib/OpenLayers/Control/KeyboardDefaults.js +++ b/lib/OpenLayers/Control/KeyboardDefaults.js @@ -75,6 +75,14 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, { */ defaultKeyPress: function (evt) { var size, handled = true; + + if((typeof evt.target) != 'undefined' && + (evt.target.tagName == 'INPUT' || + evt.target.tagName == 'TEXTAREA' || + evt.target.tagName == 'SELECT')) { + return; + } + switch(evt.keyCode) { case OpenLayers.Event.KEY_LEFT: this.map.pan(-this.slideFactor, 0);