mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-28 05:01:06 -04:00
Fix switch between modes and scrolling on adjust
The templateFolderForm JS was setting the mode to 'dialog' but not back when the state was changed back to a normal sticky element. This caused adjustments and scrolling when no adjustment needed to be accommodated. There were also problems with adjustForResize. It was manipulating the same flag that resizing the window did and returned a value never used.
This commit is contained in:
@@ -139,6 +139,8 @@
|
||||
};
|
||||
|
||||
this.render = function() {
|
||||
var mode = 'default';
|
||||
|
||||
// detach everything, unless they are the currentState
|
||||
this.states.forEach(
|
||||
state => (state.key === this.currentState ? this.$stickyBottom.append(state.$el) : state.$el.detach())
|
||||
@@ -146,8 +148,9 @@
|
||||
|
||||
// use dialog mode for states which contain more than one form control
|
||||
if (['move-to-existing-folder', 'add-new-template'].includes(this.currentState)) {
|
||||
GOVUK.stickAtBottomWhenScrolling.setMode('dialog');
|
||||
mode = 'dialog';
|
||||
}
|
||||
GOVUK.stickAtBottomWhenScrolling.setMode(mode);
|
||||
// make sticky JS recalculate its cache of the element's position
|
||||
GOVUK.stickAtBottomWhenScrolling.recalculate();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user