mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-27 12:40:55 -04:00
Put shift in focus after change to state
Moving focus before letting the sticky JS set the position of sticky elements means focus is shifted to them when they are still in the page. This causes the browser to scroll so the focused elements are visible. This moves when focus is set to after the sticky JS has set position therefore avoiding the issue.
This commit is contained in:
@@ -170,8 +170,6 @@
|
||||
state => (state.key === this.currentState ? this.$stickyBottom.append(state.$el) : state.$el.detach())
|
||||
);
|
||||
|
||||
if (currentStateObj && ('setFocus' in currentStateObj)) { currentStateObj.setFocus(); }
|
||||
|
||||
// use dialog mode for states which contain more than one form control
|
||||
if (['move-to-existing-folder', 'add-new-template'].indexOf(this.currentState) !== -1) {
|
||||
mode = 'dialog';
|
||||
@@ -179,6 +177,8 @@
|
||||
GOVUK.stickAtBottomWhenScrolling.setMode(mode);
|
||||
// make sticky JS recalculate its cache of the element's position
|
||||
GOVUK.stickAtBottomWhenScrolling.recalculate();
|
||||
|
||||
if (currentStateObj && ('setFocus' in currentStateObj)) { currentStateObj.setFocus(); }
|
||||
};
|
||||
|
||||
this.nothingSelectedButtons = $(`
|
||||
|
||||
Reference in New Issue
Block a user