Select to view content in your preferred language

MapView container restricted to a DIV element with 4.25 release

3859
3
Jump to solution
11-14-2022 01:22 PM
BryanMc
Frequent Contributor

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)?

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

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

View solution in original post

0 Kudos
3 Replies
AlexNguyen1
Emerging Contributor

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.

0 Kudos
UndralBatsukh
Esri Regular Contributor

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

0 Kudos
BryanMc
Frequent Contributor

Thank you. I can confirm this is fixed in the beta 4.26 release and allows for different elements again.

0 Kudos