File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 22
22
23
23
< script >
24
24
$ ( function ( ) {
25
- $ ( "#dialog" ) . dialog ( {
26
- modal : true ,
27
- height : 300 ,
28
- width : 500
29
- } ) ;
25
+ var dialog = $ ( "#dialog" ) . dialog ( {
26
+ modal : true ,
27
+ height : 300 ,
28
+ width : 500
29
+ } ) ,
30
30
31
- var datepickerDialog = $ ( "#dialog-datepicker" ) . dialog ( {
31
+ datepickerDialog = $ ( "#dialog-datepicker" ) . dialog ( {
32
32
autoOpen : false ,
33
33
modal : true
34
34
} ) ,
39
39
width : 600
40
40
} ) ;
41
41
42
+ $ ( "#open-dialog" ) . click ( function ( ) {
43
+ dialog . dialog ( "open" ) ;
44
+ } ) ;
45
+
42
46
$ ( "#open-datepicker" ) . click ( function ( ) {
43
47
datepickerDialog . dialog ( "open" ) ;
44
48
} ) ;
70
74
71
75
< a href ="# "> Outside link</ a >
72
76
77
+ < button id ="open-dialog "> Reopen dialog</ button >
78
+
73
79
< div id ="dialog " title ="Basic dialog ">
74
80
< p > This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</ p >
75
81
< p > < button id ="open-datepicker "> Open another window with a datepicker.</ button > </ p >
Original file line number Diff line number Diff line change @@ -248,6 +248,13 @@ $.widget("ui.dialog", {
248
248
this . overlay . destroy ( ) ;
249
249
}
250
250
251
+ if ( ! this . opener . filter ( ":focusable" ) . focus ( ) . length ) {
252
+ // Hiding a focused element doesn't trigger blur in WebKit
253
+ // so in case we have nothing to focus on, explicitly blur the active element
254
+ // https://bugs.webkit.org/show_bug.cgi?id=47182
255
+ $ ( this . document [ 0 ] . activeElement ) . blur ( ) ;
256
+ }
257
+
251
258
if ( this . options . hide ) {
252
259
this . _hide ( this . uiDialog , this . options . hide , function ( ) {
253
260
that . _trigger ( "close" , event ) ;
@@ -278,6 +285,8 @@ $.widget("ui.dialog", {
278
285
options = this . options ,
279
286
uiDialog = this . uiDialog ;
280
287
288
+ this . opener = $ ( this . document [ 0 ] . activeElement ) ;
289
+
281
290
this . _size ( ) ;
282
291
this . _position ( options . position ) ;
283
292
uiDialog . show ( options . show ) ;
You can’t perform that action at this time.
0 commit comments