mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
Move setting of sticky mode out of recalculate
The `recalculate` method currently does three things: 1. sync's the internal store with the DOM 2. updates the saved positional and dimensional data from the new DOM 3. allows the mode to be set The problem with using it as the way to set the mode is that, every call to it is effectively setting the mode but this isn't always the intention. This splits off setting the mode so other modules have to explicity set it and those that don't intend to can just call `recalculate` to notify of DOM changes.
This commit is contained in:
@@ -144,9 +144,12 @@
|
||||
state => (state.key === this.currentState ? this.$stickyBottom.append(state.$el) : state.$el.detach())
|
||||
);
|
||||
|
||||
// make sticky JS recalculate its cache of the element's position
|
||||
// use dialog mode for states which contain more than one form control
|
||||
GOVUK.stickAtBottomWhenScrolling.recalculate({ 'mode': 'dialog' });
|
||||
if (['move-to-existing-folder', 'add-new-template'].includes(this.currentState)) {
|
||||
GOVUK.stickAtBottomWhenScrolling.setMode('dialog');
|
||||
}
|
||||
// make sticky JS recalculate its cache of the element's position
|
||||
GOVUK.stickAtBottomWhenScrolling.recalculate();
|
||||
};
|
||||
|
||||
this.nothingSelectedButtons = $(`
|
||||
|
||||
Reference in New Issue
Block a user