Dante 11 年之前
父节点
当前提交
7d7ab4bb28

+ 16 - 0
dist/js/bootstrap-dialog.js

@@ -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) {
@@ -834,6 +847,9 @@
             }
             this.setOpened(false);
 
+            // Move focus to the last visible dialog.
+            BootstrapDialog.moveFocus();
+
             return this;
         }
     };

文件差异内容过多而无法显示
+ 1 - 1
dist/js/bootstrap-dialog.min.js


+ 16 - 0
examples/assets/bootstrap-dialog/js/bootstrap-dialog.js

@@ -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) {
@@ -834,6 +847,9 @@
             }
             this.setOpened(false);
 
+            // Move focus to the last visible dialog.
+            BootstrapDialog.moveFocus();
+
             return this;
         }
     };

文件差异内容过多而无法显示
+ 1 - 1
examples/assets/bootstrap-dialog/js/bootstrap-dialog.min.js


+ 16 - 0
src/js/bootstrap-dialog.js

@@ -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) {
@@ -834,6 +847,9 @@
             }
             this.setOpened(false);
 
+            // Move focus to the last visible dialog.
+            BootstrapDialog.moveFocus();
+
             return this;
         }
     };