1

I am trying to use the ol3 KeyboardPan, from the API documentation "this interaction is by default included in maps, the keys can only be used when browser focus is on the element to which the keyboard events are attached. By default, this is the map div".

I am not able to get this to work on my application or on any of the examples. How does one focus the browser on the map div? What am I missing?

  • 1
    I resolved this issue by setting keyboardEventTarget: document in the map options... this is not an obvious solution based on the API documentation IMHO. – Bwyss Apr 6 '16 at 16:10
  • It's OK (and appropriate) to answer your own question so that others can find an answer to the same problem more easily. So please change your comment to an answer and mark it as the accepted answer. – Kirk Kuykendall Apr 6 '16 at 17:19
1

Make your map HTMLElement (div) focusable:

<div id="map" tabindex="0"></div>
0

I resolved this issue by setting keyboardEventTarget: document in the map options... this is not an obvious solution based on the API documentation IMHO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.