Open andreas-web opened 2 weeks ago
A "hacky" method to get around this is:
const offcanvas = new bootstrap.Offcanvas('#offcanvas');
let save = offcanvas._config.backdrop;
offcanvas._config.backdrop = 'static';
offcanvas.show();
window.setTimeout(function () {
offcanvas._config.backdrop = save;
}, 500);
It seems to be related to #39780
Prerequisites
Describe the issue
If an offcanvas (or modal) is not triggered via a button with data-bs-toggle, but is opened "manually" via a pointerup or pointerdown event, it closes again immediately on some touch devices because the backdrop receives an additional event.
Reduced test cases
You can see this clearly in this fiddle: https://jsfiddle.net/andreas_walter/cpoL102a/ (To test with e.g. microsoft surface touchscreen or android tablet)
What operating system(s) are you seeing the problem on?
Windows, Android
What browser(s) are you seeing the problem on?
Chrome, Firefox, Microsoft Edge, Opera
What version of Bootstrap are you using?
v5.3.3