mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
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.
This commit is contained in:
parent
10ca48308f
commit
51eb28e76e
18
ui/jquery.ui.dialog.js
vendored
18
ui/jquery.ui.dialog.js
vendored
@ -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() {
|
_createOverlay: function() {
|
||||||
if ( !this.options.modal ) {
|
if ( !this.options.modal ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var widgetFullName = this.widgetFullName;
|
var that = this,
|
||||||
|
widgetFullName = this.widgetFullName;
|
||||||
if ( !$.ui.dialog.overlayInstances ) {
|
if ( !$.ui.dialog.overlayInstances ) {
|
||||||
// Prevent use of anchors and inputs.
|
// Prevent use of anchors and inputs.
|
||||||
// We use a delay in case the overlay is created from an
|
// We use a delay in case the overlay is created from an
|
||||||
@ -706,10 +717,7 @@ $.widget( "ui.dialog", {
|
|||||||
// Handle .dialog().dialog("close") (#4065)
|
// Handle .dialog().dialog("close") (#4065)
|
||||||
if ( $.ui.dialog.overlayInstances ) {
|
if ( $.ui.dialog.overlayInstances ) {
|
||||||
this.document.bind( "focusin.dialog", function( event ) {
|
this.document.bind( "focusin.dialog", function( event ) {
|
||||||
if ( !$( event.target ).closest(".ui-dialog").length &&
|
if ( !that._allowInteraction( event ) ) {
|
||||||
// TODO: Remove hack when datepicker implements
|
|
||||||
// the .ui-front logic (#8989)
|
|
||||||
!$( event.target ).closest(".ui-datepicker").length ) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(".ui-dialog:visible:last .ui-dialog-content")
|
$(".ui-dialog:visible:last .ui-dialog-content")
|
||||||
.data( widgetFullName )._focusTabbable();
|
.data( widgetFullName )._focusTabbable();
|
||||||
|
Loading…
Reference in New Issue
Block a user