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]: Reopen Modal #5917

Closed
e-ademi opened this issue Dec 30, 2024 · 2 comments
Closed

[Bug]: Reopen Modal #5917

e-ademi opened this issue Dec 30, 2024 · 2 comments
Labels

Comments

@e-ademi
Copy link

e-ademi commented Dec 30, 2024

Blazorise Version

1.4.2

What Blazorise provider are you running on?

Bootstrap4

Link to minimal reproduction or a simple code snippet

<div>
    <Modal @ref="_modalRef">
        <ModalContent Centered>
            <ModalHeader>
                <ModalTitle>@_title</ModalTitle>
                <CloseButton Clicked="@(() => Confirm(false))" />
            </ModalHeader>
            <ModalBody>
                <Text>
                    @_text
                </Text>
                <Div Margin="Margin.Is2.FromTop">
                    @ChildContent
                </Div>
            </ModalBody>
            <ModalFooter>
                <Button Color="Color.Secondary" Clicked="@(() => Confirm(false))">@_cancelButtonTranslation</Button>
                <Button Color="Color.Dark" TextColor="TextColor.White" Clicked="@(() => Confirm(true))">@_confirmButtonTranslation</Button>
            </ModalFooter>
        </ModalContent>
    </Modal>
</div>

@code {

    [Parameter]
    public RenderFragment ChildContent { get; set; }

    [Parameter]
    public EventHandler<bool> Confirmed { get; set; }

    string _title = null;
    string _text = null;
    string _confirmButtonTranslation = null;
    string _cancelButtonTranslation = null;

    Modal _modalRef;

    protected override Task OnParametersSetAsync()
    {
        _confirmButtonTranslation ??= "Ja";
        _cancelButtonTranslation ??= "Nein";
        return base.OnParametersSetAsync();
    }

    public async Task Show(string confirmText, string title = null, string confirmButtonTranslation = null, string cancelButtonTranslation = null)
    {
        if (confirmButtonTranslation != null) _confirmButtonTranslation = confirmButtonTranslation;
        if (cancelButtonTranslation != null) _cancelButtonTranslation = cancelButtonTranslation;
        _title = title;
        _text = confirmText;

        await _modalRef.Show();
    }

    public async Task Hide()
    {
        await _modalRef.Hide();
    }

    private async Task Confirm(bool confirmed)
    {
        Confirmed.Invoke(this, confirmed);
        await _modalRef.Hide();
    }
}

Steps to reproduce & bug description

Open this modal (modal: A) in another modal (modal: B), and then cancel modal A. Open the modal A again.

What is expected?

After reopening the Modal A, it should be visible.

What is actually happening?

After reopening the Modal A, it is not visible. I do not get any errors in console. Even a method "Opened" in Modal A is called after trying to reopen. It just do not show up.

What browsers do you see the problem on?

No response

Any additional comments?

No response

@e-ademi e-ademi added the Type: Bug 🐞 Something isn't working label Dec 30, 2024
@stsrki
Copy link
Collaborator

stsrki commented Dec 30, 2024

Hello @e-ademi, I tried your example, and it works for me. Can you upgrade your project to the latest version and see if it happens again?

Copy link
Contributor

Hello @e-ademi, thank you for your submission. The issue was labeled "Status: Repro Missing" because you have not provided a way to reproduce the issue quickly. Most problems can be solved when isolated, but we would like you to provide a reproducible code sample to help us investigate a possible bug more effectively.
For your convenience, you can use our pre-configured Bug Report Template repositories to quickly set up a reproducible environment.
Once you've provided a minimal reproduction, we can proceed with the investigation. Thank you for helping us improve Blazorise!

@e-ademi e-ademi closed this as completed Jan 6, 2025
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