Revert "Merge pull request #2855 from alphagov/revert-2843-stop-sticky-overlapping-focus"

This reverts commit 0f9969989a, reversing
changes made to 42e3770e65.
This commit is contained in:
Tom Byers
2019-03-20 14:04:06 +00:00
parent 9789727f95
commit 5ba2bd66e0
3 changed files with 169 additions and 5 deletions

View File

@@ -33,10 +33,11 @@
this.activateStickyElements();
// first off show the new template / new folder buttons
this.currentState = this.$form.data('prev-state') || 'unknown';
if (this.currentState === 'unknown') {
this._lastState = this.$form.data('prev-state');
if (this._lastState === undefined) {
this.selectActionButtons();
} else {
this.currentState = this._lastState;
this.render();
}
@@ -144,11 +145,21 @@
}
};
// method that checks the state against the last one, used prior to render() to see if needed
this.stateChanged = function() {
let changed = this.currentState !== this._lastState;
this._lastState = this.currentState;
return changed;
};
this.actionButtonClicked = function(event) {
event.preventDefault();
this.currentState = $(event.currentTarget).val();
this.render();
if (this.stateChanged()) {
this.render();
}
};
this.selectionStatus = {
@@ -173,7 +184,9 @@
this.currentState = 'nothing-selected-buttons';
}
this.render();
if (this.stateChanged()) {
this.render();
}
this.selectionStatus.update(numSelected);