@@ -217,8 +217,6 @@ $.widget("ui.dialog", {
217
217
self . _trigger ( "close" , event ) ;
218
218
}
219
219
220
- $ . ui . dialog . overlay . resize ( ) ;
221
-
222
220
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
223
221
if ( self . options . modal ) {
224
222
maxZ = 0 ;
@@ -255,11 +253,6 @@ $.widget("ui.dialog", {
255
253
if ( options . zIndex > $ . ui . dialog . maxZ ) {
256
254
$ . ui . dialog . maxZ = options . zIndex ;
257
255
}
258
- if ( self . overlay ) {
259
- $ . ui . dialog . maxZ += 1 ;
260
- $ . ui . dialog . overlay . maxZ = $ . ui . dialog . maxZ ;
261
- self . overlay . $el . css ( "z-index" , $ . ui . dialog . overlay . maxZ ) ;
262
- }
263
256
264
257
// Save and then restore scroll
265
258
// Opera 9.5+ resets when parent z-index is changed.
@@ -402,7 +395,6 @@ $.widget("ui.dialog", {
402
395
$ ( this )
403
396
. removeClass ( "ui-dialog-dragging" ) ;
404
397
self . _trigger ( "dragStop" , event , filteredUi ( ui ) ) ;
405
- $ . ui . dialog . overlay . resize ( ) ;
406
398
}
407
399
} ) ;
408
400
} ,
@@ -448,7 +440,6 @@ $.widget("ui.dialog", {
448
440
options . height = $ ( this ) . height ( ) ;
449
441
options . width = $ ( this ) . width ( ) ;
450
442
self . _trigger ( "resizeStop" , event , filteredUi ( ui ) ) ;
451
- $ . ui . dialog . overlay . resize ( ) ;
452
443
}
453
444
} )
454
445
. css ( "position" , position )
@@ -676,9 +667,8 @@ $.extend( $.ui.dialog.overlay, {
676
667
instances : [ ] ,
677
668
// reuse old instances due to IE memory leak with alpha transparency (see #5185)
678
669
oldInstances : [ ] ,
679
- maxZ : 0 ,
680
670
events : $ . map (
681
- "focus, mousedown,mouseup, keydown, keypress,click " . split ( ", " ) ,
671
+ "focus mousedown click keydown keypress" . split ( " " ) ,
682
672
function ( event ) {
683
673
return event + ".dialog-overlay" ;
684
674
}
@@ -692,34 +682,23 @@ $.extend( $.ui.dialog.overlay, {
692
682
// handle $(el).dialog().dialog('close') (see #4065)
693
683
if ( $ . ui . dialog . overlay . instances . length ) {
694
684
$ ( document ) . bind ( $ . ui . dialog . overlay . events , function ( event ) {
695
- // stop events if the z-index of the target is < the z-index of the overlay
696
- // we cannot return true when we don't want to cancel the event (#3523)
697
- if ( $ ( event . target ) . zIndex ( ) < $ . ui . dialog . overlay . maxZ ) {
698
- return false ;
685
+ if ( ! $ ( event . target ) . closest ( ".ui-dialog" ) . length ) {
686
+ event . preventDefault ( ) ;
687
+ // TODO: focus top-most dialog
688
+ $ ( ".ui-dialog" ) . focus ( 1 ) ;
699
689
}
700
690
} ) ;
701
691
}
702
692
} , 1 ) ;
703
-
704
- // allow closing by pressing the escape key
705
- $ ( document ) . bind ( "keydown.dialog-overlay" , function ( event ) {
706
- if ( dialog . options . closeOnEscape && ! event . isDefaultPrevented ( ) && event . keyCode &&
707
- event . keyCode === $ . ui . keyCode . ESCAPE ) {
708
-
709
- dialog . close ( event ) ;
710
- event . preventDefault ( ) ;
711
- }
712
- } ) ;
713
-
714
- // handle window resize
715
- $ ( window ) . bind ( "resize.dialog-overlay" , $ . ui . dialog . overlay . resize ) ;
716
693
}
717
694
718
695
var $el = ( this . oldInstances . pop ( ) || $ ( "<div>" ) . addClass ( "ui-widget-overlay" ) )
719
696
. appendTo ( document . body )
720
697
. css ( {
721
- width : this . width ( ) ,
722
- height : this . height ( )
698
+ width : "100%" ,
699
+ height : "100%" ,
700
+ position : "fixed" ,
701
+ zIndex : $ . ui . dialog . maxZ
723
702
} ) ;
724
703
725
704
if ( $ . fn . bgiframe ) {
@@ -741,86 +720,6 @@ $.extend( $.ui.dialog.overlay, {
741
720
}
742
721
743
722
$el . height ( 0 ) . width ( 0 ) . remove ( ) ;
744
-
745
- // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
746
- var maxZ = 0 ;
747
- $ . each ( this . instances , function ( ) {
748
- maxZ = Math . max ( maxZ , this . css ( "z-index" ) ) ;
749
- } ) ;
750
- this . maxZ = maxZ ;
751
- } ,
752
-
753
- height : function ( ) {
754
- var scrollHeight ,
755
- offsetHeight ;
756
- // handle IE
757
- if ( $ . browser . msie ) {
758
- scrollHeight = Math . max (
759
- document . documentElement . scrollHeight ,
760
- document . body . scrollHeight
761
- ) ;
762
- offsetHeight = Math . max (
763
- document . documentElement . offsetHeight ,
764
- document . body . offsetHeight
765
- ) ;
766
-
767
- if ( scrollHeight < offsetHeight ) {
768
- return $ ( window ) . height ( ) + "px" ;
769
- } else {
770
- return scrollHeight + "px" ;
771
- }
772
- // handle "good" browsers
773
- } else {
774
- return $ ( document ) . height ( ) + "px" ;
775
- }
776
- } ,
777
-
778
- width : function ( ) {
779
- var scrollWidth ,
780
- offsetWidth ;
781
- // handle IE
782
- if ( $ . browser . msie ) {
783
- scrollWidth = Math . max (
784
- document . documentElement . scrollWidth ,
785
- document . body . scrollWidth
786
- ) ;
787
- offsetWidth = Math . max (
788
- document . documentElement . offsetWidth ,
789
- document . body . offsetWidth
790
- ) ;
791
-
792
- if ( scrollWidth < offsetWidth ) {
793
- return $ ( window ) . width ( ) + "px" ;
794
- } else {
795
- return scrollWidth + "px" ;
796
- }
797
- // handle "good" browsers
798
- } else {
799
- return $ ( document ) . width ( ) + "px" ;
800
- }
801
- } ,
802
-
803
- resize : function ( ) {
804
- /* If the dialog is draggable and the user drags it past the
805
- * right edge of the window, the document becomes wider so we
806
- * need to stretch the overlay. If the user then drags the
807
- * dialog back to the left, the document will become narrower,
808
- * so we need to shrink the overlay to the appropriate size.
809
- * This is handled by shrinking the overlay before setting it
810
- * to the full document size.
811
- */
812
- var $overlays = $ ( [ ] ) ;
813
- $ . each ( $ . ui . dialog . overlay . instances , function ( ) {
814
- $overlays = $overlays . add ( this ) ;
815
- } ) ;
816
-
817
- $overlays . css ( {
818
- width : 0 ,
819
- height : 0
820
- } ) . css ( {
821
- width : $ . ui . dialog . overlay . width ( ) ,
822
- height : $ . ui . dialog . overlay . height ( )
823
- } ) ;
824
723
}
825
724
} ) ;
826
725
0 commit comments