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

Preventing scroll is not working for nested Offcanvas #2784

Open
junkwama opened this issue Dec 18, 2023 · 0 comments
Open

Preventing scroll is not working for nested Offcanvas #2784

junkwama opened this issue Dec 18, 2023 · 0 comments

Comments

@junkwama
Copy link

  • components: Offcanvas
  • reactstrap version #18.2.0
  • import method umd
  • react version #18.2.0
  • bootstrap version #9.2.1

What is happening?

When closing an OffCanvas nested in an other of in others, regarless of if there are still other opened ancestor OffCanvas, the body.overflow is set back to null.

close() {
    this.manageFocusAfterClose();
    Offcanvas.openCount = Math.max(0, Offcanvas.openCount - 1);
    document.body.style.overflow = null;
    setScrollbarWidth(this._originalBodyPadding);
  }

What should be happening?

The body document.body.style.overflow stay "hidden" if there are still some opened Offcanvas.

close() {
    this.manageFocusAfterClose();
    Offcanvas.openCount = Math.max(0, Offcanvas.openCount - 1);
    if(Offcanvas.openCount === 0) document.body.style.overflow = null;
    setScrollbarWidth(this._originalBodyPadding);
  }

Steps to reproduce issue

  1. Create a offcanvas nested in an other offcanvas
  2. set the scrollable prop to false to both of them
  3. open both
  4. close the child offcanvas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant