From a078bc24f08ff193a8e0ab62a8df6d2d8aafcd66 Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Sat, 30 May 2015 15:36:38 +0200 Subject: [PATCH] register key listener on document instead of map container (needs focus) --- js/plugin/Routing.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/plugin/Routing.js b/js/plugin/Routing.js index 45463a2..32f1ae1 100644 --- a/js/plugin/Routing.js +++ b/js/plugin/Routing.js @@ -107,6 +107,10 @@ BR.Routing = L.Routing.extend({ } }, this._draw); + // keys not working when map container does not have focus, use document instead + L.DomEvent.removeListener(this._container, 'keyup', this._keyupListener); + L.DomEvent.addListener(document, 'keyup', this._keyupListener, this); + // enable drawing mode this.draw(true);