NOTE: This breaks accessibility in Safari, which doesn't allow setting focus to elements that are not natively tabbable. However, our current stance is that people who require accessibility will not be using Safari specifically for this type of reason.
}
}));
- // set focus to the first tabbable element in:
- // - content area
- // - button pane
- // - title bar
+ // 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.find('.ui-dialog-titlebar :tabbable:first'))
+ .add(uiDialog)
.filter(':first')
.focus();