[OpenLayers-Users] openlayers 2.12rc5 & KeyboardDefaults

Marcelo Bianchi mbianchi at gfz-potsdam.de
Tue Jun 5 02:43:27 PDT 2012


Hi Eric,

Thanks for the quick reply and check !

Yes was exactly this issue. Okay, using the observeElement attribute the 
issue goes away and the results is much improved when compared to the 2.11.

Maybe to avoid this issue the KeyboardDefaults control should by default 
be attached to the map div if nothing is specified on the class 
instantiation.

with my best regards,

Marcelo

On 06/05/2012 11:20 AM, Eric Lemoine wrote:
> On Tue, Jun 5, 2012 at 11:09 AM, Eric Lemoine
> <eric.lemoine at camptocamp.com>  wrote:
>> On Tue, Jun 5, 2012 at 10:30 AM, Marcelo Bianchi
>> <mbianchi at gfz-potsdam.de>  wrote:
>>> Dear List,
>>>
>>> There looks like to be a issue with the release 2.12/rc5 when using the
>>> KeyboardDefaults control on the map.
>>>
>>> When I added this control to the map, I am unable to type any "-" or "+" on
>>> any form element of my page.
>>>
>>> Maybe this was triggered by the commits related to this improvement.
>>>
>>> https://github.com/openlayers/openlayers/pull/222
>>>
>>> but the side effects are quite bad.
>>>
>>> The code I am using to trigger the problem is attached.
>>> I tested the code with opera/firefox/google-chrome and the result is the
>>> same.
>>>
>>> regards,
>>
>>
>> Is the problem new with 2.12?
>
> I just did some tests. With 2.11 pressing the plus key when the text
> field has the focus both zooms the map and adds "+" to the field. With
> 2.12 the map zooms but "+" is not added to the field.
>
> With 2.12 you can reach a behavior that is better than with 2.11. Use
> the following:
>
> new OpenLayers.Control.KeyboardDefaults({observeElement: 'map'})]}
>
> and
>
> <div id="map" tabindex="0" style="margin: 0px; width: 100%; height:
> 250px; border: 1px Solid black;"></div>
>
> (note the tabindex attribute)
>
> With this the map will zoom/dezoom only when the map has the focus.
> See the accessible.html example for more information.
>
> I hope this addresses your problems.

-- 
Deutsches GeoForschungsZentrum - GFZ
Geofon ~ Sektion 2.4 ~ Seismologie
Phone +49 331-288-28704
Telegrafenberg A3
14473 Potsdam


More information about the Users mailing list