Skip to content

Commit

Permalink
refs #56
Browse files Browse the repository at this point in the history
  • Loading branch information
nakupanda committed Jul 17, 2014
1 parent 2b2e5ad commit 7d7ab4b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
16 changes: 16 additions & 0 deletions dist/js/bootstrap-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@
});
};

/**
* Move focus to next visible dialog.
*/
BootstrapDialog.moveFocus = function() {
var lastDialogInstance = null;
$.each(BootstrapDialog.dialogs, function(id, dialogInstance) {
lastDialogInstance = dialogInstance;
});
if (lastDialogInstance !== null && lastDialogInstance.isRealized()) {
lastDialogInstance.getModal().focus();
}
};

BootstrapDialog.prototype = {
constructor: BootstrapDialog,
initOptions: function(options) {
Expand Down Expand Up @@ -834,6 +847,9 @@
}
this.setOpened(false);

// Move focus to the last visible dialog.
BootstrapDialog.moveFocus();

return this;
}
};
Expand Down
2 changes: 1 addition & 1 deletion dist/js/bootstrap-dialog.min.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions examples/assets/bootstrap-dialog/js/bootstrap-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@
});
};

/**
* Move focus to next visible dialog.
*/
BootstrapDialog.moveFocus = function() {
var lastDialogInstance = null;
$.each(BootstrapDialog.dialogs, function(id, dialogInstance) {
lastDialogInstance = dialogInstance;
});
if (lastDialogInstance !== null && lastDialogInstance.isRealized()) {
lastDialogInstance.getModal().focus();
}
};

BootstrapDialog.prototype = {
constructor: BootstrapDialog,
initOptions: function(options) {
Expand Down Expand Up @@ -834,6 +847,9 @@
}
this.setOpened(false);

// Move focus to the last visible dialog.
BootstrapDialog.moveFocus();

return this;
}
};
Expand Down

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/js/bootstrap-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@
});
};

/**
* Move focus to next visible dialog.
*/
BootstrapDialog.moveFocus = function() {
var lastDialogInstance = null;
$.each(BootstrapDialog.dialogs, function(id, dialogInstance) {
lastDialogInstance = dialogInstance;
});
if (lastDialogInstance !== null && lastDialogInstance.isRealized()) {
lastDialogInstance.getModal().focus();
}
};

BootstrapDialog.prototype = {
constructor: BootstrapDialog,
initOptions: function(options) {
Expand Down Expand Up @@ -834,6 +847,9 @@
}
this.setOpened(false);

// Move focus to the last visible dialog.
BootstrapDialog.moveFocus();

return this;
}
};
Expand Down

0 comments on commit 7d7ab4b

Please sign in to comment.