diff --git a/CHANGELOG.md b/CHANGELOG.md index f2f95cb..41a023c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,17 @@ # Change Log -## v0.4.0 +## v1.0.0 -- Adds optional callback to options so that developers can take additional action when the user selects a result. +- Fixes a bug with search-on-enter interfering with arrow key-based navigation (https://github.com/stadiamaps/maplibre-search-box/issues/1) + +## v0.6.0 + +- Support changing the base URL (ex: for EU endpoints) ## v0.5.0 - Adds arrow key-based navigation! -## v0.6.0 +## v0.4.0 -- Support changing the base URL (ex: for EU endpoints) +- Adds optional callback to options so that developers can take additional action when the user selects a result. diff --git a/index.html b/index.html index 382c01c..59ac457 100644 --- a/index.html +++ b/index.html @@ -19,11 +19,12 @@ var control = new MapLibreSearchControl({ useMapFocusPoint: true, + searchOnEnter: true, }); var navControl = new maplibregl.NavigationControl(); var map = new maplibregl.Map({ container: "map", - style: "https://tiles.stadiamaps.com/styles/alidade_smooth.json", // stylesheet location + style: "https://tiles.stadiamaps.com/styles/outdoors.json", // stylesheet location center: [-74.5, 40], // starting position [lng, lat] zoom: 2, // starting zoom hash: "map", diff --git a/package.json b/package.json index d01cc58..5d3e33c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stadiamaps/maplibre-search-box", - "version": "0.6.0", + "version": "1.0.0", "homepage": "https://docs.stadiamaps.com/", "repository": "https://github.com/stadiamaps/maplibre-search-box", "license": "BSD-3-Clause", diff --git a/src/index.ts b/src/index.ts index b3961d7..91a1c5f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -116,11 +116,11 @@ export class MapLibreSearchControl implements IControl { async onKey(e: KeyboardEvent) { switch (e.key) { case "Enter": - if (this.options.searchOnEnter) { - await this.onInput(e, true); - } else if (this.selectedResultIndex !== null) { + if (this.selectedResultIndex !== null) { this.onSelected(this.resultFeatures[this.selectedResultIndex]); this.input.blur(); + } else if (this.options.searchOnEnter) { + await this.onInput(e, true); } break; case "Escape":