Basaingeal / Razor.SweetAlert2

A Razor class library for interacting with SweetAlert2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Width Option not working

WakanaYuki opened this issue · comments

Describe the bug
The Width Option in SweetAlertOptions is not working. Changing the value does not have any effect on the Alert.

To Reproduce

await Swal.FireAsync(new SweetAlertOptions
{
    Title = "Some Message",
     Width = "500",
     Background = "#fff url(someimage)"
});

Expected behavior
The Alert should change in Width size. I even tried dumb number, like 10, 1000, and such. They had no different effect.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox (does work with SweetAlert2 in JS though, tested it on this browser)

Edit:
Changed code snippet to code tag

I will look into this. I suspect that the JS version handles numbers and number strings differently.

Does it work if you use "500px" instead of "500"?
If so, that could be a workaround until I have a fix. I will likely need to convert strings to numbers if its a number string.

Okay, I tested it. "500px" is working.
Sorry, I am really embarrassed, that I haven't tried that yet ^^'

No problem. I appreciate the bug report because it is a deviation from the JS library, and I want to make the API's as similar as possible.

I'll leave the issue open until I have a fix in place so the example in your code snippet works.

This should be fixed in the next release.

Thanks again for bringing it to my attention.