Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Do not update geocoder control results on special keys #1104

Open
wants to merge 2 commits into
base: publisher-production
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/geocoder_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ var geocoder = require('./geocoder'),
var GeocoderControl = L.Control.extend({
includes: L.Mixin.Events,

//tab, esc, left, right, enter, up, down
specialKeyCodes: [9, 27, 37, 39, 13, 38, 40],

options: {
proximity: true,
position: 'topleft',
Expand Down Expand Up @@ -183,7 +186,8 @@ var GeocoderControl = L.Control.extend({
}, this._updateSubmit);
},

_autocomplete: function() {
_autocomplete: function(e) {
if (this.specialKeyCodes.indexOf(e.keyCode) !== -1) return;
if (!this.options.autocomplete) return;
if (this._input.value === '') return this._updateAutocomplete();
this.geocoder.query({
Expand Down