The view on key-down / on key-up event is not firing on Internet Explorer 11. Anyone having the same issue?
I can reproduce the issue on my end... Anyone who wants to see can use the following:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Intro to MapView - Create a 2D map - 4.5</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.5/esri/css/main.css">
<script src="https://js.arcgis.com/4.5/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function(Map, MapView) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
//console not logging in IE
view.on("key-down", function(evt){
console.log("key-down", evt);
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
It works on IE 11 running on Windows 10 but not in IE 11 running on Windows 7
It might be worth trying to add a native event listener for keydown to the view container:
view.container.addEventListener("keydown", function(evt){...});
It's interesting that this may depend on OS version. My feeling is that this may have to do with whether the view is focused or not. Different OS/different browsers may have slightly different rules.