Skip to main content

Search and Top Navigation

#5950 closed enhancement (wontfix)

Opened August 14, 2010 11:22AM UTC

Closed August 14, 2010 12:15PM UTC

Last modified October 23, 2012 01:44PM UTC

Create an option to disable the focusing code in

Reported by: erikkallen Owned by:
Priority: minor Milestone:
Component: ui.dialog Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description contains the code below (as of 1.7.2, I checked the latest release and the code is similar).

The filters with :tabbable are nice, but if you have complex content in the dialog, they can take a long time to run. Some of my dialogs take minutes(!) to open on older machines with IE6. Monkey-patching to remove the tabbing code made the dialog open instantly, so the tabbing is obviously a major performance hog for complex dialogs.

I therefore suggest adding an option to disable this code in a future version, although that might require another way of determining if the focus leaves a modal dialog.

Relevant code from 1.7.2:

prevent tabbing out of modal dialogs

(options.modal && uiDialog.bind('keypress.ui-dialog', function(event) {

if (event.keyCode != $.ui.keyCode.TAB) {



var tabbables = $(':tabbable', this),

first = tabbables.filter(':first')[0],

last = tabbables.filter(':last')[0];

if ( == last && !event.shiftKey) {

setTimeout(function() {


}, 1);

} else if ( == first && event.shiftKey) {

setTimeout(function() {


}, 1);



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'))




Attachments (0)
Change History (3)

Changed August 14, 2010 12:15PM UTC by scottgonzalez comment:1

resolution: → wontfix
status: newclosed

Disabling this code would cause accessibility problems. You'll be able to deal with the performance issue when #4731 is implemented and you can explicitly specify which element should gain focus.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:2

milestone: TBD

Milestone TBD deleted

Changed October 23, 2012 01:44PM UTC by scottgonzalez comment:3

#8719 is a duplicate of this ticket.