[OpenLayers-Trac] [OpenLayers] #1108: Modify feature example problems with IE. keyboard handler broken in IE

OpenLayers trac at openlayers.org
Thu Apr 10 12:20:02 EDT 2008


#1108: Modify feature example problems with IE. keyboard handler broken in IE
-------------------------------+--------------------------------------------
  Reporter:  openlayers        |       Owner:         
      Type:  bug               |      Status:  new    
  Priority:  minor             |   Milestone:         
 Component:  Handler.Keyboard  |     Version:  2.6 RC2
Resolution:                    |    Keywords:         
     State:                    |  
-------------------------------+--------------------------------------------
Changes (by openlayers):

  * version:  2.5 => 2.6 RC2

Comment:

 Dear Developers,

 I'm doing some investigation about the OL's KeyboardDefaults Control. I've
 notice that this control isn't working in both IE and Opera, as it was
 stated here in this thread and in another one:
 http://www.nabble.com/Opera-and-KeyboardDefaults-tt12141147.html#a12141147

 I've checked the tickets for this issue:
 http://trac.openlayers.org/ticket/864
 http://trac.openlayers.org/ticket/1108

 There, someone suggest altering the "window" to "document", in two places
 in the "KeyboardDefaults.js" file. And there was a comment suggesting to
 change the event handled to "onkeypress" to "onkeydown", considering the
 problems with "onkeypress" events in IE, as PPK demonstrates at:
 http://www.quirksmode.org/js/keys.html

 I've tested changing from "window" to "document", as the ticket suggets.
 And I've changed also the "onkeypress" event to "onkeydown" in
 "Handler/Keyboard.js" file.

 This makes IE and Opera catch the keyboard events, but there's another
 problem. It seems IE catch the "onkeydown" event twice with the "+" and
 "-" keys used to zoom (I'm using IE6). And there's another problem with
 Opera. In Opera, the "+" and "-" keys are used to increase the zoom of the
 page (it changes both font and image sizes). So, pressing the "+" and "-"
 keys to zoom in a map will also zoom the intire document.

 I've noted that changing the event to "onkeyup" seems to fix the problem
 in IE. But the Opera still has the problem with the "+" and "-" keys. I
 think the solution will be canceling the event propagation. Does the OL
 has any function to cancel event propagations? I don't know if Prototype
 has this feature.

 There's a cross-browser solution from Dean Edwards:
 http://dean.edwards.name/weblog/2005/10/add-event2/

 Anyway, I'm seding the patch for the modification of
 "Control/KeyboardDefaults.js" and "Handler/Keyboard.js" if there's anyone
 interested in investigate this issue. The patch were created over
 2.6-RC2's root.

 regards,

 Pedro Simonetti.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/1108#comment:2>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list