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

Nested dynamic modals onhide problems. #786

Open
christiancvi opened this issue Jul 2, 2024 · 1 comment
Open

Nested dynamic modals onhide problems. #786

christiancvi opened this issue Jul 2, 2024 · 1 comment

Comments

@christiancvi
Copy link

Steps to reproduce the behavior:

  1. Create dynamic fullscreen modal with Modal ref and showasync...
  2. Inside this, create other dynamic fullscreen modal with Modal ref.... and showasync
  3. Inside last, create dynamic modal (size large but not fullscreen) with same method modal ref... showasync
  4. When close last modal, the scroll show body scroll, not to the last modal scroll.

Expected behavior:
I think what should happen is that when closing the last dialog, the nesting modals should be preserved correctly, and the body scroll should not appear.

  • .NET Version: , .NET 8
  • BlazorBootstrap: 3.0.0-preview.2
  • Blazor Web App
@christiancvi
Copy link
Author

christiancvi commented Jul 2, 2024

Solved adding this script:

document.addEventListener('hidden.bs.modal', function (event) {            
            if (event.target.classList.contains('modal')) {
                var modals = document.querySelectorAll('.modal.show');
               
                if (modals.length > 0) {
                    document.body.style.overflow = 'hidden';
                    document.body.style.paddingRight = '0px';
                }
            }
        });

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