I am using React and the standard kt-drawer. I want to see how I can prevent the drawer from closing if the user clicks outside of the drawer itself.
I only want it to close when the user clicks on the X button at the top right of the drawer. How do I change this behavior?
Hi,
Sorry for the delay in reply.
At the moment, configuration for this functionality isn't available on a drawer instance but you can easily add a new drawer property to enable it.
Copy the _createOverlay function from this gist. Update the _createOverlay function in src/_metronic/assets/ts/components/_DrawerComponent.ts with the copied content.
With these changes, you can prevent the drawer from closing when users click on the overlay by adding the data-kt-drawer-permanent="true" attribute to your drawer element.
Please let us know if you have any further questions on this topic or anything else.
Regards,
Lauris Stepanovs,
Keenthemes Support Team