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

OpenLayers trac at openlayers.org
Fri Jul 4 03:05:15 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:                    |  
-------------------------------+--------------------------------------------
Old description:

> In Modify-feature example is not possible to delete a node with IE.
> According to my investigations in IE keyboard handler is broken and no
> event is fired on supported types of events (keypress, keydown and
> keyup).
>
> I found that changing "window" with "document" in the following lines of
> keyboard.js works  with IE6 and Firefox, I don't know if it is correct
> with other browers types
>
> In noticed also that in IE delete key do not fire keypress event,
> probably it will be better to use keydown event, tacking into account
> that in this case we will have a different code (68 for "d" instead of
> 100). Could be a better solution to use prototype to handle this?
>
> I found that the suggested modifications resolve ticket #864 if we use
> keydown event  instead of keypress (a stated
> http://www.quirksmode.org/js/keys.html keypress event does not fire in ie
> for arrow key buttons.
>
> activate: function() {
>         if (OpenLayers.Handler.prototype.activate.apply(this, arguments))
> {
>             for (var i = 0; i < this.KEY_EVENTS.length; i++) {
>                 OpenLayers.Event.observe(
>                     '''window''', this.KEY_EVENTS[i],
> this.eventListener);
>             }
>             return true;
>         } else {
>             return false;
>         }
>     }
>
>     deactivate: function() {
>         var deactivated = false;
>         if (OpenLayers.Handler.prototype.deactivate.apply(this,
> arguments)) {
>             for (var i = 0; i < this.KEY_EVENTS.length; i++) {
>                 OpenLayers.Event.stopObserving(
>                     '''window''', this.KEY_EVENTS[i],
> this.eventListener);
>             }
>             deactivated = true;
>         }
>         return deactivated;
>     }

New description:

 In Modify-feature example is not possible to delete a node with IE.
 According to my investigations in IE keyboard handler is broken and no
 event is fired on supported types of events (keypress, keydown and keyup).

 I found that changing "window" with "document" in the following lines of
 keyboard.js works  with IE6 and Firefox, I don't know if it is correct
 with other browers types

 In noticed also that in IE delete key do not fire keypress event, probably
 it will be better to use keydown event, tacking into account that in this
 case we will have a different code (68 for "d" instead of 100). Could be a
 better solution to use prototype to handle this?

 I found that the suggested modifications resolve ticket #864 if we use
 keydown event  instead of keypress (a stated
 http://www.quirksmode.org/js/keys.html keypress event does not fire in ie
 for arrow key buttons.
 {{{
 activate: function() {
         if (OpenLayers.Handler.prototype.activate.apply(this, arguments))
 {
             for (var i = 0; i < this.KEY_EVENTS.length; i++) {
                 OpenLayers.Event.observe(
                     '''window''', this.KEY_EVENTS[i], this.eventListener);
             }
             return true;
         } else {
             return false;
         }
     }

     deactivate: function() {
         var deactivated = false;
         if (OpenLayers.Handler.prototype.deactivate.apply(this,
 arguments)) {
             for (var i = 0; i < this.KEY_EVENTS.length; i++) {
                 OpenLayers.Event.stopObserving(
                     '''window''', this.KEY_EVENTS[i], this.eventListener);
             }
             deactivated = true;
         }
         return deactivated;
     }
 }}}

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


More information about the Trac mailing list