Active Assembly outline resizing bug

We’ve encountered a problem with not being able to resize or hide the outline in Active Assembly. Luckily, we’ve isolated the problem and come up with a quick fix, so I wanted to share in case any others run into the same problem.

Sometimes, when our users tried to drag the element that resizes AA’s outline pane (div.dojoSplitContainerSizerH), the resizing functionality would break and they were unable to grow or shrink that pane. Worse, the cookie that saved the size of the outline pane was also getting corrupted with a NaN instead of an integer to note the size for the pane, causing the display of all subsequent pages loaded in AA to break.

After some investigation, we isolated the problem to WHERE the user clicked on the resizer. If they grabbed the resizer with the very left pixel, the resizer broke. When they clicked on any other pixel, the resizer worked. Turns out the offending line of code was in dojo.js, line 20035, in the beginSizing function (we’re using version 6.7.0 build 200906P01 [3330, RX-16757]). Namely:

<code>
beginSizing = function(e, i) {
this.paneBefore = this.children[i];
this.paneAfter = this.children[i+1];
this.isSizing = true;
this.sizingSplitter = this.sizers[i];
this.originPos = dojo.html.getAbsolutePosition(this.children[0].domNode, true, dojo.html.boxSizing.MARGIN_BOX);
if (this.isHorizontal) {
var client = (e.layerX ? e.layerX : e.offsetX);
var screen = e.pageX;
this.originPos = this.originPos.x;
}
else {
var client = (e.layerY ? e.layerY : e.offsetY);
var screen = e.pageY;
this.originPos = this.originPos.y;
}
this.startPoint = this.lastPoint = screen;
this.screenToClientOffset = screen - client;
this.dragOffset = this.lastPoint - this.paneBefore.sizeActual - this.originPos - this.paneBefore.position;
[function continues…]
}</code>

The offending line is in bold. When clicking on the left-most pixel of the resizer, e.layerX is 0, so the ternary operator will move on to e.offsetX. However, for some reason, e.offsetX was undefined (inspecting the event object revealed that neither offsetX nor offsetY were present), causing “undefined” to get subtracted from an integer and a NaN error to cascade all over the place.

This was easily fixed by changing “e.offsetX” to “0”. It looks like this value is only meant to account for the width of the resizer in the sizing calculations, so at most the sizing will only be off by a few pixels, which is much better than sizing breaking altogether. The fix could be applied in dojo.js, but we chose to overwrite the function (window.dojo.widget.SplitContainer.prototype.beginSizing) from an external script to preserve dojo.js. Now resizing is working like a charm, no matter where the resizer is grabbed from.