Basaingeal / Razor.SweetAlert2

A Razor class library for interacting with SweetAlert2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swal2-input conficts with open Bootstrap 4 modal

RestoreMonarchy opened this issue · comments

Describe the bug
When I fire SweetAlert2 with input, the input is disabled and I cannot type in it

To Reproduce
Method triggered on load and button onclick

private async Task ConfirmRemoveItemAsync(MarketItem marketItem)
{
    await Swal.FireAsync(new SweetAlertOptions()
    {
        Title = "Are you sure?",
        Text = $"{marketItem.Id} ({marketItem.ItemName}) will be moved to your buyings",
        Icon = SweetAlertIcon.Warning,
        ShowCancelButton = true,
        ConfirmButtonText = "Yes, remove it!"
    }).ContinueWith(async (swalTask) => 
    {
        if (Convert.ToBoolean(swalTask.Result.Value))
        {
            await RemoveItemAsync(marketItem);
        }
    });
}

Expected behavior
I should be able to write in input even if Bootstrap modal is opened

Screenshots
OnInitialized when Bootstrap modal isn't opened
image

When triggered by "Change Price" button when Bootstrap modal is opened
image

For now I made it close bootstrap modal when the Change Price button is clicked and it works then, but I think it should be working with Bootstrap modal opened too.

2020-05-10_10-27-50

I'll take a look at this. However, I'm almost positive that this is a problem with the upstream sweetalert2 JavaScript library, and not with this Blazor wrapper. I know this because I ran into this problem myself on another project when I was using both Bootstrap and SweetAlert.

I would recommend doing a quick test using the JavaScript sweetalert2 library, and if you see the problem there too, open an issue for there instead. If you don't see the issue there, then let me know because it's somehow restricted to just this wrapper's implementation.

Hey @Basaingeal thanks for reply,
It looks like you're right, there's the same issue with JavaScript sweetalert2 library. I tried it like this: https://codepen.io/MichaelCrow/pen/MWaBVEq

I'm gonna report it in JavaScript SweetAlert2 repo issues.

Closing due to closure of issue in upstream library.