I need to embed an ArcGIS Server JavaScript API (version 4) map in a client's Content Management System. For reasons unknown to me, the CMS developers said this results in the map's entire DOM being placed inside a <form>
tag.
Doing so prevents the map from loading and displaying, although the JS appears to run correctly.
I've put together a simple demonstration at https://codepen.io/slead/pen/QWWedvd - if you comment/uncomment the <form>
tag you can see that placing the map inside the form results in the map not displaying, even though the console logs show that the JS has run.
<!--HTML-->
<body>
<form>
<div id="viewDiv"></div>
</form>
</body>
// JavaScript
require(["esri/Map", "esri/views/MapView"], function(Map, MapView) {
console.log("Before");
var map = new Map({basemap: "streets"});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65]
});
console.log("After");
});
How can I enable the map functionality when the map's elements are located inside a <form>
?