Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Close info popup on escape key

Russ Garrettef261599980a
diff --git a/web/src/infopopup.ts b/web/src/infopopup.ts
index 44c20f7..9a144cd 100644
--- a/web/src/infopopup.ts
+++ b/web/src/infopopup.ts
@@ -102,6 +102,12 @@ class InfoPopup {
this._map.getCanvas().style.cursor = ''
}
})
+
+ document.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape' && this.popup_obj) {
+ this.popup_obj.remove()
+ }
+ })
}
osmLink(id: number, is_node: boolean) {