Blazored / Modal

A powerful and customizable modal implementation for Blazor applications.
https://blazored.github.io/Modal/
MIT License
786 stars 186 forks source link

Modal not showing #590

Open Woudjee opened 2 weeks ago

Woudjee commented 2 weeks ago

Hi,

I followed the documentation. When using the cascading parameter, my ModalService instance is not set. I therefore now use: @inject IModalService Modal. When using this, I can see that the show method is called. However, the modal is not showing. I have attempted this in the <head>: <link rel="stylesheet" href="{assembly name}.styles.css" /> as well as <link rel="stylesheet" href="_content/Blazored.Modal/Blazored.Modal.bundle.scp.css" />. I also added @rendermode InteractiveServer to the place where I am calling the example button. I don't understand what I am doing wrong. Thank you in advance.

Woudjee

bertarribas3 commented 1 week ago

Hello, I was having the same issue as you and I have just made what @wallyhall wrote in #537 (May 20th 2024):

I have added <CascadingBlazoredModal /> in the page I am showing the modal and remove <CascadingBlazoredModal> from Routes.razor.

For now it is working properly.

:)

skcncx commented 1 week ago

@bertarribas3 I also added the to the top of the page I'm opening the modal from and while it works, kind of, I have also noticed that subsequent navigations eventually breaks all modal stuff. Have you noticed that as well?

It's obvious when you open browser debug tools and look at the console window... it's having issues cleaning up the modal stuff on page navigation.

I have created my project with the .net8 blazor app template utilizing all render modes... some pages are purely static, some SSR interactive and some are CSR, though, at the moment, I'm only wanting to launch modal dialogs from wasm based pages/components.

At the moment, it appears Blazored Modal does not work with blazor sites switching rendering modes and I have yet to figure out how to implement it correctly for just one render mode context.