From 64d90b4a710d520a44408ccfa8df1100b0b95b4d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 16 Jul 2010 16:57:04 -0400 Subject: [PATCH] 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. --- ui/jquery.ui.dialog.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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; -- 2.39.5