@@ -38,6 +38,8 @@ export class Editor extends LitElementWw {
3838 @query ( "#alert" )
3939 private accessor alertDialog ! : SlDialog ;
4040
41+ private dialogOpenedAt = 0 ;
42+
4143 public static get scopedElements ( ) : Record < string , typeof LitElement > {
4244 return {
4345 "webwriter-blocks-toolbar" : Toolbar ,
@@ -78,7 +80,7 @@ export class Editor extends LitElementWw {
7880
7981 public render ( ) : TemplateResult {
8082 return html `
81- < sl-dialog id ="prompt " no-header >
83+ < sl-dialog id ="prompt " no-header @sl-request-close = ${ this . handleDialogRequestClose } >
8284 < span > </ span >
8385 < sl-input autofocus placeholder =""> </ sl-input >
8486 < sl-button slot ="footer " @click ="${ ( ) => this . promptDialog . hide ( ) } "> Cancel</ sl-button >
@@ -143,9 +145,18 @@ export class Editor extends LitElementWw {
143145 this . promptDialog . hide ( ) . catch ( ) ;
144146 } ) ;
145147 button . parentNode . replaceChild ( clonedButton , button ) ;
148+ this . dialogOpenedAt = Date . now ( ) ;
146149 this . promptDialog . show ( ) . catch ( ) ;
147150 }
148151
152+ private handleDialogRequestClose ( event : CustomEvent ) : void {
153+ // Prevent dialog from closing by the same event that opened it
154+ // (affected change value pop-up on mobile devices)
155+ if ( event . detail . source === "overlay" && Date . now ( ) - this . dialogOpenedAt < 100 ) {
156+ event . preventDefault ( ) ;
157+ }
158+ }
159+
149160 private handleConfirm ( message : string , callback : ( confirmed : boolean ) => void ) : void {
150161 Logger . log ( this , message , callback ) ;
151162 const titleSpan = this . confirmDialog . querySelector ( "span" ) ;
0 commit comments