Topic: Avoid modal close when ESC key is pressed
sergiojaviercaz premium asked 2 years ago
Is there a way to avoid the modal closing when ESC key is pressed ? I tried trapping the keydown event and using preventDefault but it seems not to take that in consideration and the modal closes anyway.
Mateusz Lazaru staff answered 2 years ago
We've provided an keyboard
option to do that.
Code you're looking for: data-mdb-keyboard='false'
Check out my snippet:
https://mdbootstrap.com/snippets/standard/mlazaru/4767753
All modal options are described here: https://mdbootstrap.com/docs/standard/components/modal/#api-section-options
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Premium
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 6.0.1
- Device: PC
- Browser: Chrome
- OS: W11
- Provided sample code: No
- Provided link: No