codyhouse / codyhouse-framework

A lightweight front-end framework for building accessible, bespoke interfaces.
https://codyhouse.co/
MIT License
1.16k stars 171 forks source link

Add an option to disable closing a modal by clicking Escape or clicking the backdrop #135

Closed lro-tiierisch closed 1 year ago

lro-tiierisch commented 1 year ago

In my opinion you should add an option to disable closing a modal by clicking on its backdrop as well as an option to disable closing a modal by clicking the ESC key.

claudia-romano commented 1 year ago

Hi there, thanks for the suggestion. ESC key - this has been implemented for keyboard accessibility, so I would suggest not to change it. As for the backdrop, you should be able to do that by setting a pointer-events none to the .modal element and then setting it to auto for both the .modalclose-btn and the .modalcontent element.