-
Notifications
You must be signed in to change notification settings - Fork 2
/
MapDescription.html
74 lines (65 loc) · 1.54 KB
/
MapDescription.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!--
Codepen sample: https://codepen.io/kellyhutchins/pen/KKxWvyz
-->
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>
Map Description
</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.26/esri/themes/light/main.css" />
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
</style>
<script src="https://js.arcgis.com/4.26/"></script>
<script>
require(["esri/views/MapView", "esri/core/reactiveUtils", "esri/WebMap"], (
MapView,
reactiveUtils,
WebMap
) => {
const map = new WebMap({
portalItem: {
id: "f2e9b762544945f390ca4ac3671cfa72"
}
});
const view = new MapView({
map,
container: "viewDiv"
});
view.when(() => {
document.getElementById("mapDescription").innerHTML =
map.portalItem.snippet;
view.container.setAttribute("aria-describedby", "mapDescription");
const rootNode = document.getElementsByClassName("esri-view-surface");
for (let k = 0; k < rootNode.length; k++) {
rootNode[k].setAttribute("aria-describedby", "mapDescription");
}
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="mapDescription" class="sr-only"></div>
</body>
</html>