Unplanned
Last Updated: 09 Jun 2023 11:51 by ADMIN
Josef
Created on: 08 Jan 2019 12:32
Category: Dialog
Type: Feature Request
7
Dialog should NOT close after pressing the escape-key
How could I configure the dialog to NOT close after pressing the escape key
9 comments
ADMIN
Martin Bechev
Posted on: 09 Jun 2023 11:51

Hi Gabor,

Indeed you are right, so far there is no parameter that can be used to distinguish if the Escape key is pressed or the X close icon in the title bar is clicked.

What could be done in the meantime is to prevent close action using the preventAction callback:

preventAction:(args)=>{
    if(args instanceof DialogCloseResult){
         return true
     }
},

and use a custom component for the Dialog content. Thus the Dialog can still be closed by handling the respective button click events. Here is an example where the Escape key doesn't close the Dialog while all other options remain unchanged:

https://stackblitz.com/edit/angular-itjo1r

Regards,
Martin
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.
Gabor
Posted on: 02 Jun 2023 14:00
4 years later we also find ourselves in need of this feature. Our use-case features a custom drag & drop solution inside the dialog. We want the drag & drop to be cancellable by pressing Esc, without the dialog closing. Calling preventDefault on the event from inside has no effect on the dialog's behaviour, and the current DialogSettings.preventAction callback does not differentiate between the X (close) button and Esc button press. Moreover the original event that triggers the dialog's action is not included in the callback's parameters, so we can't handle it there.
ADMIN
Dimiter Madjarov
Posted on: 01 Apr 2019 07:55
Hello Joseph,


Thank you for sharing this with us. We are looking to provide the functionality out of the box in the upcoming weeks.

Regards,
Dimiter Madjarov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Josef
Posted on: 28 Mar 2019 12:51

I finally managed to implement this behavior by using 

 event.stopPropagation();

 

So if the focus is on an element inside the modal (textbox) this prohibits closing the modal.

ADMIN
Dimiter Madjarov
Posted on: 29 Jan 2019 07:51
Hello Josef,


Thank you for the input on this feature request. Implementing it is in our short-term development plans.

Regards,
Dimiter Madjarov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Josef
Posted on: 25 Jan 2019 06:38
Here is my licenses user profile
Josef
Posted on: 23 Jan 2019 12:23

Hello again,

Since I use the DialogService this 

  doCloseOnEscapeKey

option might become part of the DialogSettings interface.

    open(options: DialogSettings): DialogRef;

Thank you very much.

Your components are awesome!!

 

Kind Regards,

Josef

Josef
Posted on: 21 Jan 2019 08:21

Hello Dimiter,

 

Thank you for your reply.

I understand that this might not be a high priority issue. Nevertheless it might be easy and not time-consuming to implement.

 

I am looking forward to an Angular-Component-Input to deactivate this "doCloseOnEscapeKey" functionality.

 

Kind regards,

Josef

 


ADMIN
Dimiter Topalov
Posted on: 14 Jan 2019 09:22
Hello Josef,

Thank you for sharing your suggestion.

Currently preventing the Dialog from closing when the Escape key is pressed is not supported. However, we also believe that providing our customers with the ability to prevent Dialog closing when the end user presses Escape will be a nice enhancement, and we are considering adding it in a future version of the Dialog package.

We will track the customer demand for this functionality in this thread, and prioritize accordingly when updating our roadmap.

On a side note, please open Support tickets for specific questions and issues, related to usage of our components, and their configuration.

Regards,
Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.