Fix bugs around operations happening between modes

The `release` method is meant to clean up a sticky
element before removal from the store.

The part of this that cleared CSS added due to
being in dialog mode was only run if still in that
mode.

In the template folder JS, we set the mode before
running `recalculate` so elements can be cleaned
in a different mode to that they were last in.
This meant some CSS wasn't being cleaned up.

This sometimes caused an effect where elements
that were added back to the DOM but not stuck
would still have CSS used when they were last
stuck.

This commit also includes the addition of some
missing code that adds back CSS to offset an
element when in a dialog stack.
This commit is contained in:
Tom Byers
2019-02-11 17:50:47 +00:00
parent 09848009c1
commit 30844143ec

View File

@@ -576,9 +576,8 @@
el.removeStickyClasses(this);
$el.css('width', '');
if (_mode === 'dialog') {
dialog.releaseEl(el, this);
}
// clear styles from any elements stuck while in a dialog mode
dialog.releaseEl(el, this);
el.removeShim();
el.release(this);
}
@@ -658,9 +657,15 @@
}
};
stickAtTop.unstop = function (el) {
var offset = 0;
if (_mode === 'dialog') {
offset = dialog.getOffsetFromEdge(el, this);
}
el.$fixedEl.css({
'position': '',
'top': ''
'top': offset + 'px'
});
el.unstop();
};