From c2dde8e0910d00bf59799f49267a32c8b7465420 Mon Sep 17 00:00:00 2001 From: Christian Mayer Date: Wed, 24 Apr 2024 09:50:48 +0200 Subject: [PATCH] Make OpenLayers keyboard navigation work Adds tabIndex attribute to the map's container, so it gets focusable. Otherwise the OL keyboard navigation won't work, see 'keyboardEventTarget' in https://openlayers.org/en/latest/apidoc/module-ol_Map.html --- src/components/ol/Map.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/ol/Map.vue b/src/components/ol/Map.vue index 18013f3b..86dc6e5e 100644 --- a/src/components/ol/Map.vue +++ b/src/components/ol/Map.vue @@ -78,6 +78,11 @@ export default { me.map.updateSize(); }); resizeObserver.observe(container); + + // add tabIndex attribute to the map's container, so it gets focusable. + // Otherwise the OL keyboard navigation won't work, see keyboardEventTarget + // in https://openlayers.org/en/latest/apidoc/module-ol_Map.html + container.tabIndex = '0'; } // Send the event 'ol-map-mounted' with the OL map as payload