BS5 - If Canvas + Modal open, close Modal closes Canvas at the same time

Wappler Version : 3.9.6
Operating System : Mac
Server Model: NodeJS
Database Type: MySql
Hosting Type: AWS DOCKER

Expected behavior

What do you think should happen?

I have a canvas open, and on click I open a modal from the canvas. Both remain open as expected. I then wish to close the modal but have the canvas remain open.

Actual behavior

What actually happens?

Closing the modal closes the canvas too.

Unfortunately, this is a Bootstrap quirk. The Modal and Off-canvas share the same JavaScript. Any action will affect both.

Work arounds:

  1. Code to stop the Off-canvas from closing when the Modal is closed. This will be similar to (see Bootstrap documentation)
var myModalEl = document.getElementById('myModal')
myModalEl.addEventListener('hide.bs.modal', function (event) {
  // do something...
})
  1. Create your own Off-canvas. For an example, see
    How To Create an Off-Canvas Menu
    or search for similar.
1 Like

Thanks @ben I didn’t realise.

Wappler team perhaps change this from bug to how to please.