Skip to content

Commit 64d90b4

Browse files
committed
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.
1 parent 9d01ab5 commit 64d90b4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

ui/jquery.ui.dialog.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,9 @@ $.widget("ui.dialog", {
324324

325325
// set focus to the first tabbable element in the content area or the first button
326326
// if there are no tabbable elements, set focus on the dialog itself
327-
$([])
328-
.add(uiDialog.find('.ui-dialog-content :tabbable:first'))
329-
.add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first'))
330-
.add(uiDialog)
331-
.filter(':first')
332-
.focus();
327+
$(self.element.find(':tabbable').get().concat(
328+
uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
329+
uiDialog.get()))).eq(0).focus();
333330

334331
self._trigger('open');
335332
self._isOpen = true;

0 commit comments

Comments
 (0)