Hidden iframe map display issues in 3.14

2984
2
08-28-2015 11:29 AM
ChrisSmith7
Frequent Contributor

I cross-posted this in Hiding the map: problems with building a mobile application with AngularJS as a side discussion, but thought it would be best to ask a formal question.

I am having a similar issue as discussed/resolved in Re: How to properly resize map from hidden iframe​; however, Bjorn mentioned this issue was probably fixed in 3.14 - I am unsure if this is something new or maybe even unique to my application.

I am embedding a map within an iframe inside of a hidden container div; I've dealt with this bug since 3.8. Essentially, after page load, users can elect to toggle a div, which should render/hide the map. This works beautifully if the container is rendered to the dom and visible on the page on first load, but it chokes when the container is hidden:

For me, the first place it seems to be bubbling-up is in "dojox/gfx/_base". When the _addLabels function in "LabelLayer.js" is called, we go out to:

this._addLabel(h, b, a.renderer, c, e, g, k)

Then, we try to calculate label height:

e.labelHeight = l.getHeight() / 2;

This is where it chokes. "l" has font info, but font size is undefined. So, the call to getHeight() in "esri/symbols/TextSymbol" sends an undefined font size to normalizedLength() in "dojox/gfx/_base", which gives me "Unable to get property 'length' of undefined or null reference" in the console. All because the map container div is collapsed/hidden - I think the map is confused as it doesn't have a reference to size things appropriately.

I have been working around this by toggling the container on, then quickly collapsing the div after page load. It looks kludgy, but works well, although it gets complicated as there are maps throughout the application, and user settings are persisted.

Is there a better way to accomplish this? I have some resize logic that works well elsewhere, but seems not to cut it here - I've reviewed the resolution in Re: How to properly resize map from hidden iframe without success.

Any help would be appreciated! If this is a bug in 3.14, maybe Esri will fix it!

0 Kudos
2 Replies
ChrisSmith7
Frequent Contributor

I should also mention this occurs in IE11 - the map loads well in Chrome without any special handling.

0 Kudos
ChrisSmith7
Frequent Contributor

I wasn't able to find an easy solution - I ended-up just showing it briefly, then hiding the container as a workaround.

0 Kudos