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.
Thanks, but it doesn’t work (it’s just ignored). I tried:
me.ExecuteJavaScript(“myModal.dataset.bs.keyboard = ‘false’;”)
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.
I’m sorry, I mean: create an Issue so Xojo add the option that Bootstrap 5 offers (Static Backdrop), so we don’t need to add JavaScript or other workarounds.
it’s not “mymodal” but the control id of your dialog, and a ‘#’ before in the javascript, and “_modal” for the dialog…)
something like (for xojo 2023r2+)
Ah, sorry.
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.
Are Javascript errors logged somewhere so I could see what’s the problem?
so, it’s working again, and I use setAttribute(“data-bs-keyboard”,“false”) under bootstrap 5
but it seems xojo dialog are modified “on the fly” and you can’t add a javascript to the modal dialog control…
it works with a websdk, but I don’t see how to make it work with xojo built-in modals