Starting with the 4.25 release, the MapView container property must reference an ID of a DIV element. This aligns with the documentation for the container property (HTMLDivElement) for 4.25 and even historical help versions. However, in previous versions (4.24) this wasn't enforced allowing developers to use other element types: SPAN, MAIN, P, etc.
An error message: [esri.views.MapView]" "#container" "element with id 'viewDiv' not found will be in the console.
Is it possible to update the error message to be more specific in this scenario, or list a breaking change in the what's new for 4.25 section (recognizing it was listed as a HTMLDivElement requirement historically but not enforced)?
Solved! Go to Solution.
Hi there,
At 4.25, we added the check so that users would get a warning message if the container doesn't exist.
We revisited our implementation so that the error will be thrown only if the named element does not exist. You now will be able to add a map to different elements. You can test the fix in our next release: https://codepen.io/U_B_U/pen/bGxNgEM?editors=1000
I agree that this needs to be added in the breaking changes section. It took me a couple of hours to figure out the cause of this issue. Then I was able to see why thanks to this thread.
Hi there,
At 4.25, we added the check so that users would get a warning message if the container doesn't exist.
We revisited our implementation so that the error will be thrown only if the named element does not exist. You now will be able to add a map to different elements. You can test the fix in our next release: https://codepen.io/U_B_U/pen/bGxNgEM?editors=1000
Thank you. I can confirm this is fixed in the beta 4.26 release and allows for different elements again.