aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.dialog.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2013-02-20 17:35:48 -0500
committerScott González <scott.gonzalez@gmail.com>2013-02-20 17:35:48 -0500
commit51eb28e76e372fe0af12724edff0b5780b5e5ed0 (patch)
tree2d994d58d036d74883152c66a073c6733cf949a1 /ui/jquery.ui.dialog.js
parent10ca48308fea6a9b30d2457fbf5a1b6e0ed5966c (diff)
downloadjquery-ui-51eb28e76e372fe0af12724edff0b5780b5e5ed0.tar.gz
jquery-ui-51eb28e76e372fe0af12724edff0b5780b5e5ed0.zip
Dialog: Extract check for which elements can gain focus into its own method for overriding. Fixes #9087 - Dialog: Allow registering elements outside a dialog for use when a modal dialog is open.
Diffstat (limited to 'ui/jquery.ui.dialog.js')
-rw-r--r--ui/jquery.ui.dialog.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 9d61cf745..b35c0ffcf 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -692,12 +692,23 @@ $.widget( "ui.dialog", {
}
},
+ _allowInteraction: function( event ) {
+ if ( $( event.target ).closest(".ui-dialog").length ) {
+ return true;
+ }
+
+ // TODO: Remove hack when datepicker implements
+ // the .ui-front logic (#8989)
+ return !!$( event.target ).closest(".ui-datepicker").length;
+ },
+
_createOverlay: function() {
if ( !this.options.modal ) {
return;
}
- var widgetFullName = this.widgetFullName;
+ var that = this,
+ widgetFullName = this.widgetFullName;
if ( !$.ui.dialog.overlayInstances ) {
// Prevent use of anchors and inputs.
// We use a delay in case the overlay is created from an
@@ -706,10 +717,7 @@ $.widget( "ui.dialog", {
// Handle .dialog().dialog("close") (#4065)
if ( $.ui.dialog.overlayInstances ) {
this.document.bind( "focusin.dialog", function( event ) {
- if ( !$( event.target ).closest(".ui-dialog").length &&
- // TODO: Remove hack when datepicker implements
- // the .ui-front logic (#8989)
- !$( event.target ).closest(".ui-datepicker").length ) {
+ if ( !that._allowInteraction( event ) ) {
event.preventDefault();
$(".ui-dialog:visible:last .ui-dialog-content")
.data( widgetFullName )._focusTabbable();