]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Using new delayed focus method. Also fixed a bug where focus would leave...
authorScott González <scott.gonzalez@gmail.com>
Sat, 18 Apr 2009 18:49:49 +0000 (18:49 +0000)
committerScott González <scott.gonzalez@gmail.com>
Sat, 18 Apr 2009 18:49:49 +0000 (18:49 +0000)
ui/ui.dialog.js

index 0a36874140263288049ccfc19fc575ade7f5107d..cc400863088a9f52f5d242bc14afcf97d1e71560 100644 (file)
@@ -241,17 +241,15 @@ $.widget("ui.dialog", {
                        }
 
                        var tabbables = $(':tabbable', this),
-                               first = tabbables.filter(':first')[0],
-                               last  = tabbables.filter(':last')[0];
-
-                       if (event.target == last && !event.shiftKey) {
-                               setTimeout(function() {
-                                       first.focus();
-                               }, 1);
-                       } else if (event.target == first && event.shiftKey) {
-                               setTimeout(function() {
-                                       last.focus();
-                               }, 1);
+                               first = tabbables.filter(':first'),
+                               last  = tabbables.filter(':last');
+
+                       if (event.target == last[0] && !event.shiftKey) {
+                               first.focus(1);
+                               return false;
+                       } else if (event.target == first[0] && event.shiftKey) {
+                               last.focus(1);
+                               return false;
                        }
                }));