Skip to content

Commit 60486ac

Browse files
committed
Dialog: Don't focus dialog when mousedown is on close button. Fixes #8838 - Dialog: Close icon does not work in dialog larger than the window in IE.
1 parent d179cba commit 60486ac

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ui/jquery.ui.dialog.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,14 @@ $.widget("ui.dialog", {
321321
.addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
322322
.prependTo( this.uiDialog );
323323
this._on( this.uiDialogTitlebar, {
324-
mousedown: function() {
325-
// Dialog isn't getting focus when dragging (#8063)
326-
this.uiDialog.focus();
324+
mousedown: function( event ) {
325+
// Don't prevent click on close button (#8838)
326+
// Focusing a dialog that is partially scrolled out of view
327+
// causes the browser to scroll it into view, preventing the click event
328+
if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
329+
// Dialog isn't getting focus when dragging (#8063)
330+
this.uiDialog.focus();
331+
}
327332
}
328333
});
329334

0 commit comments

Comments
 (0)