Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ui/jquery.ui.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ $.widget("ui.dialog", {
stack: true,
title: "",
width: 300,
zIndex: 1000
zIndex: 1000,
focusOnClose: false
},

_create: function() {
Expand Down Expand Up @@ -228,6 +229,10 @@ $.widget("ui.dialog", {
});
$.ui.dialog.maxZ = maxZ;
}
// restore focus of underlying page, unless overidden at some point while the dialog is open.
if (self.options.focusOnClose){
$(self.options.focusOnClose).focus();
}

return self;
},
Expand Down Expand Up @@ -281,6 +286,10 @@ $.widget("ui.dialog", {
options = self.options,
uiDialog = self.uiDialog;

// store the element with the current focus, so it can be restored when the dialog closes. Also force a Blur event to it. requires jquery core 1.6
self.options.focusOnClose = $(":focus");
$(self.options.focusOnClose).blur();

self._size();
self._position( options.position );
uiDialog.show( options.show );
Expand Down