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 2222
2323 < script >
2424 $ ( 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+ } ) ,
3030
31- var datepickerDialog = $ ( "#dialog-datepicker" ) . dialog ( {
31+ datepickerDialog = $ ( "#dialog-datepicker" ) . dialog ( {
3232 autoOpen : false ,
3333 modal : true
3434 } ) ,
3939 width : 600
4040 } ) ;
4141
42+ $ ( "#open-dialog" ) . click ( function ( ) {
43+ dialog . dialog ( "open" ) ;
44+ } ) ;
45+
4246 $ ( "#open-datepicker" ) . click ( function ( ) {
4347 datepickerDialog . dialog ( "open" ) ;
4448 } ) ;
7074
7175< a href ="# "> Outside link</ a >
7276
77+ < button id ="open-dialog "> Reopen dialog</ button >
78+
7379< div id ="dialog " title ="Basic dialog ">
7480 < 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 >
7581 < 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", {
248248 this . overlay . destroy ( ) ;
249249 }
250250
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+
251258 if ( this . options . hide ) {
252259 this . _hide ( this . uiDialog , this . options . hide , function ( ) {
253260 that . _trigger ( "close" , event ) ;
@@ -278,6 +285,8 @@ $.widget("ui.dialog", {
278285 options = this . options ,
279286 uiDialog = this . uiDialog ;
280287
288+ this . opener = $ ( this . document [ 0 ] . activeElement ) ;
289+
281290 this . _size ( ) ;
282291 this . _position ( options . position ) ;
283292 uiDialog . show ( options . show ) ;
You can’t perform that action at this time.
0 commit comments