Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#5950 closed enhancement (wontfix)

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')) .add(uiDialog) .filter(':first') .focus();

Change History (3)

comment:1 Changed 12 years ago by Scott González

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.

comment:2 Changed 10 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

comment:18 Changed 10 years ago by Scott González

#8719 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.