Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offcanvas and Modal open and close immediately on some touch devices #39987

Open
3 tasks done
andreas-web opened this issue May 15, 2024 · 2 comments
Open
3 tasks done
Labels

Comments

@andreas-web
Copy link

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

@andreas-web
Copy link
Author

andreas-web commented May 15, 2024

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); 

@andreas-web
Copy link
Author

It seems to be related to #39780

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants