Dialog auto close

1 Answer 49 Views
Dialog
Po'lot
Top achievements
Rank 1
Po'lot asked on 25 Sep 2024, 11:23 AM
If I click outside the Dialog, it won't close. Did anyone solve this problem?

1 Answer, 1 is accepted

Sort by
0
Yanko
Telerik team
answered on 25 Sep 2024, 01:01 PM

Hi, Po'lot,

Yes, you can close the Dialog when clicking outside of it. There are several ways to do that, however, I would suggest attaching `click` event to the overlay element:

document.querySelector('.k-overlay')?.addEventListener('click', closeDialogOnOverlayClick);

I prepared a demo example that displays a Dialog that behaves as needed:

I hope this solution proves useful, please let me know if further inquiries arise.

Regards,
Yanko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Dialog
Asked by
Po'lot
Top achievements
Rank 1
Answers by
Yanko
Telerik team
Share this question
or