From: Scott González Date: Fri, 16 Jul 2010 20:57:04 +0000 (-0400) Subject: Dialog: Adjusted logic for finding the first tabbable element. Fixes #5767 - On open... X-Git-Tag: 1.8.3~38^2~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=64d90b4a710d520a44408ccfa8df1100b0b95b4d;p=jquery-ui.git Dialog: Adjusted logic for finding the first tabbable element. Fixes #5767 - On open, the first tabbable element inside the dialog was never being focused in favor of the dialog container. --- diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index df896e7ea..ae96b2d8b 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -324,12 +324,9 @@ $.widget("ui.dialog", { // set focus to the first tabbable element in the content area or the first button // if there are no tabbable elements, set focus on the dialog itself - $([]) - .add(uiDialog.find('.ui-dialog-content :tabbable:first')) - .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) - .add(uiDialog) - .filter(':first') - .focus(); + $(self.element.find(':tabbable').get().concat( + uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( + uiDialog.get()))).eq(0).focus(); self._trigger('open'); self._isOpen = true;