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

[Bug]: HTML body scrollbar should be hidden when opening modal #5911

Closed
realLiangshiwei opened this issue Dec 20, 2024 · 1 comment
Closed
Assignees
Labels
Type: Bug 🐞 Something isn't working
Milestone

Comments

@realLiangshiwei
Copy link

Blazorise Version

1.6.2-1.7.1

What Blazorise provider are you running on?

Bootstrap5

Link to minimal reproduction or a simple code snippet

Image
@page "/"
@using Blazorise

<Button Color="Color.Primary" Clicked="@ShowModal">Show Modal</Button>

<div style="min-height: 1500px">
    This is some placeholder content
</div>

<Modal @ref="modalRef">
    <ModalContent Centered>
        <ModalHeader>
            <ModalTitle>Employee edit</ModalTitle>
            <CloseButton />
        </ModalHeader>
        <ModalBody>
            <Field>
                <FieldLabel>Name</FieldLabel>
                <TextEdit Placeholder="Enter name..." />
            </Field>
            <Field>
                <FieldLabel>Surname</FieldLabel>
                <TextEdit Placeholder="Enter surname..." />
            </Field>
            <Field>
                <FieldLabel>Name</FieldLabel>
                <TextEdit Placeholder="Enter name..." />
            </Field>
  
    
        </ModalBody>
        <ModalFooter>
            <Button Color="Color.Secondary" Clicked="@HideModal">Close</Button>
            <Button Color="Color.Primary" Clicked="@HideModal">Save Changes</Button>
        </ModalFooter>
    </ModalContent>
</Modal>
@code{
    // reference to the modal component
    private Modal modalRef;

    private Task ShowModal()
    {
        return modalRef.Show();
    }

    private Task HideModal()
    {
        return modalRef.Hide();
    }
}

Steps to reproduce & bug description

According to the document example of Bootstrap, it will hide the scroll bar when the modal is opened.

https://getbootstrap.com/docs/5.0/components/modal/

Image Image

What is expected?

Hide the HTML body scroll bar

What is actually happening?

It doesn't hide the HTML body scroll bar

What browsers do you see the problem on?

Chrome

Any additional comments?

No response

@realLiangshiwei realLiangshiwei added the Type: Bug 🐞 Something isn't working label Dec 20, 2024
@stsrki stsrki added this to Support Dec 20, 2024
@github-project-automation github-project-automation bot moved this to 🔙 Backlog in Support Dec 20, 2024
@stsrki stsrki added this to the 1.7 support milestone Dec 20, 2024
@stsrki
Copy link
Collaborator

stsrki commented Dec 20, 2024

@realLiangshiwei thanks for reporting this. Since we don't use any of BS5 javascript we didn't implemented this feature.

It seems that we need to some more JS logic into our Blazorise.Bootstrap5/modal.js.

@tesar-tech Look at https://github.com/twbs/bootstrap/blob/main/js/src/util/scrollbar.js, and try to bring some of that scrollbar manipulation into our modal.js, if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐞 Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants