r2477 - Dialog: Using new delayed focus method. Also fixed a bug where focus would leave the dia...
Author: scott.gonzalez
Date: Sat Apr 18 11:49:49 2009
New Revision: 2477
Modified:
trunk/ui/ui.dialog.js
Log:
Dialog: Using new delayed focus method. Also fixed a bug where focus would
leave the dialog for a fraction of a second when cycling through the
tabbable elements.
Modified: trunk/ui/ui.dialog.js
==============================================================================
--- trunk/ui/ui.dialog.js (original)
+++ trunk/ui/ui.dialog.js Sat Apr 18 11:49:49 2009
@@ -241,17 +241,15 @@
}
var tabbables = $(':tabbable', this),
- first = tabbables.filter(':first')[0],
- last = tabbables.filter(':last')[0];
+ first = tabbables.filter(':first'),
+ last = tabbables.filter(':last');
- if (event.target == last && !event.shiftKey) {
- setTimeout(function() {
- first.focus();
- }, 1);
- } else if (event.target == first && event.shiftKey) {
- setTimeout(function() {
- last.focus();
- }, 1);
+ 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;
}
}));