[OpenLayers-Users] Handler.Keyboard in IE?

Pedro Simonetti pedrosimonetti at gmail.com
Wed Apr 9 23:57:43 EDT 2008


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.
http://www.nabble.com/file/p16601627/keyboardDefaultsFix.patch
keyboardDefaultsFix.patch 

Christopher Schmidt-4 wrote:
> 
> On Fri, Nov 09, 2007 at 04:11:45PM -0600, Jeff Dege wrote:
>> I'm taking a first look at Control.ModifyFeature, in 2.5, and the delete
>> key doesn't work in IE.
>> 
>> Works fine in Firefox, but in both IE6 and IE7,
>> ModifyFeature.handleKeypress() is never called at all.  On exploring a
>> bit, it seems that Handler.Keyboard.handleKeyEvent() is never being
>> called.
>> 
>> I'm running examples/modify-feature.html, as-is, except for some alert()
>> calls stuck in various places.
>> 
>> I can see no mention in the source that this functionality doesn't work
>> in IE.  Has it simply not yet been implemented in IE?  Or is it working
>> for everybody else, and it's just me?
> 
> http://trac.openlayers.org/ticket/864
> http://trac.openlayers.org/ticket/1108
> 
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/Handler.Keyboard-in-IE--tp13676099p16601627.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list