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.

This commit is contained in:
Scott González 2010-07-16 16:57:04 -04:00
parent 9d01ab5645
commit 64d90b4a71

View File

@ -324,12 +324,9 @@ $.widget("ui.dialog", {
// set focus to the first tabbable element in the content area or the first button // 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 // if there are no tabbable elements, set focus on the dialog itself
$([]) $(self.element.find(':tabbable').get().concat(
.add(uiDialog.find('.ui-dialog-content :tabbable:first')) uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
.add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) uiDialog.get()))).eq(0).focus();
.add(uiDialog)
.filter(':first')
.focus();
self._trigger('open'); self._trigger('open');
self._isOpen = true; self._isOpen = true;