Open dmytroderyshspd opened 4 months ago
@dmytroderyshspd If you remove the data-modal-backdrop
attribute, you can do that. Is there a reason to use this attribute and do what you want?
@Lexachoc I removed the data-modal-backdrop
attribute and it allowed me closing a modal both by hitting Escape and clicking on the backdrop. That's not what I would like to achive.
I would like to allow closing a modal only by clicking a "Close" button with data-modal-hide
attribute. It means that in my case data-modal-backdrop="static"
doesn't do its job since it still allows closing a modal by hitting Escape button.
Ah I see. You can play with the boolean value closable
, see https://flowbite.com/docs/components/modal/#options:
Set to false to disable closing the modal on hitting ESC or clicking on the backdrop.
Or as a workaround, you can add a custom event listener for the ESC keydown to prevent it.
Or directly modify the source code:
Set the closable
to false
as default if that's the case for everything.
Or add this data-modal-closable
with value true|false
in the HTML and handle it in the source code:
But this is not yet implemented, PR needed.
Hello! The
data-modal-backdrop="static"
data attribute prevent the modal from closing when clicking outside of it. Could you please add thedata-modal-closable
attribute for a Modal which will disable closing the modal both on hitting ESC and clicking on the backdrop.