diff --git a/src/nominatim.js b/src/nominatim.js index 6d47e52..36a104f 100644 --- a/src/nominatim.js +++ b/src/nominatim.js @@ -57,7 +57,9 @@ export class Nominatim { setListeners() { let timeout, lastQuery; - const openSearch = () => { + const openSearch = evt => { + evt.stopPropagation(); + hasClass(this.els.control, klasses.glass.expanded) ? this.collapse() : this.expand(); @@ -77,6 +79,9 @@ export class Nominatim { this.query(value); } }; + const stopBubbling = evt => { + evt.stopPropagation(); + }; const reset = evt => { this.els.input.focus(); this.els.input.value = ''; @@ -102,6 +107,7 @@ export class Nominatim { } }; this.els.input.addEventListener('keypress', query, false); + this.els.input.addEventListener('click', stopBubbling, false); this.els.input.addEventListener('input', handleValue, false); this.els.reset.addEventListener('click', reset, false); if (this.options.targetType === TARGET_TYPE.GLASS) {