aboutsummaryrefslogtreecommitdiffstats
path: root/ui/widgets/dialog.js
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2017-08-26 13:08:14 +0200
committerFelix Nagel <info@felixnagel.com>2017-08-26 13:08:14 +0200
commit1b885ff76899fb70cce28371968d314ea74b7d7a (patch)
tree1a3a19be9d874f9daffd1238950c073ec086ffc2 /ui/widgets/dialog.js
parent2b611bad90fa6f19e3bf02912c6cd5c08903c993 (diff)
parent74f8a0ac952f6f45f773312292baef1c26d81300 (diff)
downloadjquery-ui-1b885ff76899fb70cce28371968d314ea74b7d7a.tar.gz
jquery-ui-1b885ff76899fb70cce28371968d314ea74b7d7a.zip
Merge branch 'master' into datepickerdatepicker
# Conflicts: # ui/i18n/datepicker-pt.js
Diffstat (limited to 'ui/widgets/dialog.js')
-rw-r--r--ui/widgets/dialog.js29
1 files changed, 14 insertions, 15 deletions
diff --git a/ui/widgets/dialog.js b/ui/widgets/dialog.js
index c8829331f..01780daf3 100644
--- a/ui/widgets/dialog.js
+++ b/ui/widgets/dialog.js
@@ -289,7 +289,7 @@ $.widget( "ui.dialog", {
that._trigger( "focus" );
} );
- // Track the dialog immediately upon openening in case a focus event
+ // Track the dialog immediately upon opening in case a focus event
// somehow occurs outside of the dialog before an element inside the
// dialog is focused (#10152)
this._makeFocusTarget();
@@ -863,20 +863,19 @@ $.widget( "ui.dialog", {
if ( !this.document.data( "ui-dialog-overlays" ) ) {
// Prevent use of anchors and inputs
- // Using _on() for an event handler shared across many instances is
- // safe because the dialogs stack and must be closed in reverse order
- this._on( this.document, {
- focusin: function( event ) {
- if ( isOpening ) {
- return;
- }
-
- if ( !this._allowInteraction( event ) ) {
- event.preventDefault();
- this._trackingInstances()[ 0 ]._focusTabbable();
- }
+ // This doesn't use `_on()` because it is a shared event handler
+ // across all open modal dialogs.
+ this.document.on( "focusin.ui-dialog", function( event ) {
+ if ( isOpening ) {
+ return;
}
- } );
+
+ var instance = this._trackingInstances()[ 0 ];
+ if ( !instance._allowInteraction( event ) ) {
+ event.preventDefault();
+ instance._focusTabbable();
+ }
+ }.bind( this ) );
}
this.overlay = $( "<div>" )
@@ -899,7 +898,7 @@ $.widget( "ui.dialog", {
var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
if ( !overlays ) {
- this._off( this.document, "focusin" );
+ this.document.off( "focusin.ui-dialog" );
this.document.removeData( "ui-dialog-overlays" );
} else {
this.document.data( "ui-dialog-overlays", overlays );