Topic: Issue with modal and data-keyboard
O1ivier priority asked 3 years ago
Hello,
When I try to open a modal with the sample code in your doc :
const myModal = new mdb.Modal(document.getElementById('myModal'))
I get an error message below :
MODAL: Option "keyboard" provided type "string" but expected type "boolean".
I must force the option "keyboard" to true or false in the Javascript options if I want the modal to display properly. Even if I try to display a modal with data-mdb attribute and even if I put data-mdb-keyboard="true", the error message still display.
Is this a known bug ? I must precise that my js file is the MDB5 version 3.1.0.
Thanks a lot.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Opened
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: 3.0.0
- Device: PC
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No
Grzegorz Bujański staff commented 3 years ago
I have checked it locally and unfortunately I am not able to reproduce this error. Please paste all modal code you use here.
O1ivier priority commented 3 years ago
There was a "data-keyboard='true'" on the modal that I didn't see, I just removed it and it works perfectly.
Thanks
Grzegorz Bujański staff commented 3 years ago
Modals have a keyboard option. In your case I suppose it doesn't work because you are adding
data-keyboard = 'true
instead ofdata-mdb-keyboard =' true
. As of version 3.0.0 all options now have a namespace. Therefore addingmdb
is necessary.