As can be demonstrated in a test project, a web dialog can be closed by the user by just pressing the “esc” key. Under certain circumstances, this is not wanted.
But how can we prevent this behaviour? We can’t trap the “esc” key and Xojo doesn’t provide a way to turn that “feature” off.
myModal.dataset.keyboard = 'false';
or for bootstrap 5
myModal.dataset.bs.keyboard = 'false';
Do you want to add a Feature Request to add ‘Static Backdrop’ for Bootstrap Modals?
Thanks, but it doesn’t work (it’s just ignored). I tried:
in the Opening event (and the other variation you suggest, as I’m not sure on which strap I run).
I don’t know. I’m not really a “web guy”, and when I read it’s a “modal plugin”, my reaction is I’d like Xojo to avoid relying on external resources as much as possible.
something like (for xojo 2023r2+)
and if you want to prevent clicking outside the dialog to dismiss it you can use :
ps: not tested, I use this in my websdk’s
If I find time to create an Issue in the upcoming days, I’ll gladly do it.
Thanks. I tried your new example (with and without “.bs”) and they’re still ignored.
Thanks; that’s already handled by Xojo, though.
So it should have worked in my test as well .
yes use the developper menu in most browsers, and display the console
Not necessarily as Jean-Yves uses a WebSDK and not the XojoDialog that could be implemented differently.
I tried in the dialog’s opening and showing events (one at a time, of course).
well it seems my websdk’s for the modaldialog are not working under bootstrap v5 !
the dialog is not even shown …
so, it’s working again, and I use setAttribute(“data-bs-keyboard”,“false”) under bootstrap 5
it works with a websdk, but I don’t see how to make it work with xojo built-in modals
may be @Ricardo_Cruz can tell us more about this issue ?
Thanks for your attempts.
Granted, additional information would be welcome.