Skip to content
Permalink
Browse files

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.
  • Loading branch information...
scottgonzalez committed Apr 18, 2009
1 parent 8c5ca93 commit 1b31f1aee8ef144cea2a9727569fa5efcc9aa1e5
Showing with 9 additions and 11 deletions.
  1. +9 −11 ui/ui.dialog.js
@@ -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;
}
}));

0 comments on commit 1b31f1a

Please sign in to comment.
You can’t perform that action at this time.