Merge pull request #198 from rkflx/rkflx/inhibit-shortcuts

Fix unintentional shortcut activations when typing text
This commit is contained in:
Norbert Renner 2019-06-01 11:39:17 +02:00 committed by GitHub
commit 34b253fb94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -333,8 +333,15 @@ BR.Routing = L.Routing.extend({
return segments; return segments;
}, },
// add 'esc' to disable drawing
_keyupListener: function(e) { _keyupListener: function(e) {
// Suppress shortcut handling when a text input field is focussed
if (
document.activeElement.type == 'text' ||
document.activeElement.type == 'textarea'
) {
return;
}
// add 'esc' to disable drawing
if (e.keyCode === 27) { if (e.keyCode === 27) {
this._draw.disable(); this._draw.disable();
} else { } else {