diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-04-18 18:49:49 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-04-18 18:49:49 +0000 |
commit | 1b31f1aee8ef144cea2a9727569fa5efcc9aa1e5 (patch) | |
tree | 74a194c8fa99310a68c47e7b4c783b07fcb46094 /ui | |
parent | 8c5ca934c35366e25158e211051c7f31fb1f4ffc (diff) | |
download | jquery-ui-1b31f1aee8ef144cea2a9727569fa5efcc9aa1e5.tar.gz jquery-ui-1b31f1aee8ef144cea2a9727569fa5efcc9aa1e5.zip |
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.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.dialog.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js index 0a3687414..cc4008630 100644 --- a/ui/ui.dialog.js +++ b/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; } })); |