aboutsummaryrefslogtreecommitdiffstats
path: root/ui/widgets/dialog.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/widgets/dialog.js')
-rw-r--r--ui/widgets/dialog.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/widgets/dialog.js b/ui/widgets/dialog.js
index abff0e535..4380c6f8f 100644
--- a/ui/widgets/dialog.js
+++ b/ui/widgets/dialog.js
@@ -68,6 +68,7 @@ $.widget( "ui.dialog", {
at: "center",
of: window,
collision: "fit",
+
// Ensure the titlebar is always visible
using: function( pos ) {
var topOffset = $( this ).css( pos ).offset().top;
@@ -176,6 +177,7 @@ $.widget( "ui.dialog", {
this.element
.removeUniqueId()
.css( this.originalCss )
+
// Without detaching first, the following becomes really slow
.detach();
@@ -186,6 +188,7 @@ $.widget( "ui.dialog", {
}
next = originalPosition.parent.children().eq( originalPosition.index );
+
// Don't try to place the dialog next to itself (#8613)
if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
next.before( this.element );
@@ -290,6 +293,7 @@ $.widget( "ui.dialog", {
},
_focusTabbable: function() {
+
// Set focus to the first match:
// 1. An element that was focused previously
// 2. First element inside the dialog matching [autofocus]
@@ -327,6 +331,7 @@ $.widget( "ui.dialog", {
}
event.preventDefault();
checkFocus.call( this );
+
// support: IE
// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
// so we check again later
@@ -337,6 +342,7 @@ $.widget( "ui.dialog", {
this.uiDialog = $( "<div>" )
.hide()
.attr( {
+
// Setting tabIndex makes the div focusable
tabIndex: -1,
role: "dialog"
@@ -398,10 +404,12 @@ $.widget( "ui.dialog", {
"ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
this._on( this.uiDialogTitlebar, {
mousedown: function( event ) {
+
// Don't prevent click on close button (#8838)
// Focusing a dialog that is partially scrolled out of view
// causes the browser to scroll it into view, preventing the click event
if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
+
// Dialog isn't getting focus when dragging (#8063)
this.uiDialog.trigger( "focus" );
}
@@ -478,8 +486,10 @@ $.widget( "ui.dialog", {
props = $.isFunction( props ) ?
{ click: props, text: name } :
props;
+
// Default to a non-submitting button
props = $.extend( { type: "button" }, props );
+
// Change the context for the click callback to be the main element
click = props.click;
buttonOptions = {
@@ -545,6 +555,7 @@ $.widget( "ui.dialog", {
var that = this,
options = this.options,
handles = options.resizable,
+
// .ui-resizable has position: relative defined in the stylesheet
// but dialogs have to use absolute or fixed positioning
position = this.uiDialog.css( "position" ),
@@ -639,6 +650,7 @@ $.widget( "ui.dialog", {
},
_position: function() {
+
// Need to show the dialog to get the actual offset in the position plugin
var isVisible = this.uiDialog.is( ":visible" );
if ( !isVisible ) {
@@ -695,6 +707,7 @@ $.widget( "ui.dialog", {
if ( key === "closeText" ) {
this.uiDialogTitlebarClose.button( {
+
// Ensure that we always pass a string
label: "" + value
} );
@@ -716,6 +729,7 @@ $.widget( "ui.dialog", {
}
if ( key === "resizable" ) {
+
// currently resizable, becoming non-resizable
isResizable = uiDialog.is( ":data(ui-resizable)" );
if ( isResizable && !value ) {
@@ -739,6 +753,7 @@ $.widget( "ui.dialog", {
},
_size: function() {
+
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
// divs will both have width and height set, so we need to reset them
var nonContentHeight, minContentHeight, maxContentHeight,