Cancel Modal Closing


Topic: Cancel Modal Closing

Preuss asked 5 years ago

Hey Guys,i want to cancel the closing of modals, if some condition is true. Example behavior for that are large inputs, when filling them and then accidently closing the modal, that could be really a mess. So is it possible to cancel the closing of the modal during the close event? This would give me the ability to inform the user, for example "All changes will be lost, close anyway?".

I know it would be possible by disabling background click and put these checks on buttons, but it would not be the best solution for me.

Thanks in advance.


Arkadiusz Idzikowski staff answered 5 years ago

I think that the best way to do that would be to block modal backdrop click and add document click listener with your own logic.

There is no built-in method for something like that.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 8.4.0
  • Device: Sony Vaio VPCF2
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No
Tags