Blazored / Modal

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

SetTitle(string title) not work #565

Open allrightsreserved opened 4 months ago

allrightsreserved commented 4 months ago

Describe the bug SetTitle(string title) not work

To Reproduce Steps to reproduce the behavior: protected override void OnInitialized() => BlazoredModal.SetTitle("Enter a Message");

,but the title is empty

Expected behavior the title can be set by OnInitialized()

Screenshots Screenshot 2024-03-04 230806

Hosting Model (is this issue happening with a certain hosting model?):

Additional context

chrissainty commented 3 months ago

Can you provide a repro project as I can't understand what you are doing based on your description

allrightsreserved commented 3 months ago

I just use this downloaded project, then run "Samples">"InteractiveServer" when I click the button "Show Modal" from "Returning Data" page 1

, the popup shows but without title: 2

In the file "MessageForm.razor" > "protected override void OnInitialized() => BlazoredModal.SetTitle("Enter a Message");" there are a SetTitle() function but looks not works.

Can you provide a repro project as I can't understand what you are doing based on your description

PesceJonathan commented 3 months ago

The problem was introduced in this commit since you are preventing any re-rendering of the FocusTrap. The title sits within the FocusTrap, therefore the title itself never gets re-rendered.

The solutions would either to remove the following from focus trap: image

Or it would be to change it so it would compare the child contents. If the child content is updated, we re-render the component.

Can create a PR with the fix of removing the ShouldRender tonight, but if there is a preference or reducing re-rendering I can make a PR for that instead.

PesceJonathan commented 2 months ago

Any update on this?

allrightsreserved commented 2 months ago

Yes, my problem was solved by removing the following code: image thank you :)

heckradr commented 2 months ago

Is there a build pipeline for NuGet? Version 7.3.1 there still seems to have the problem.

PesceJonathan commented 2 months ago

@heckradr No there isn't yet. The PR has still not been reviewed or accepted.

@allrightsreserved The issue shouldn't be closed. You fixed the issue you had in the example project, but the nugget still has the error in it and the project on this repo still has it.

@chrissainty Can you please help us move this forward when you get a chance.

allrightsreserved commented 1 month ago

@heckradr No there isn't yet. The PR has still not been reviewed or accepted.

@allrightsreserved The issue shouldn't be closed. You fixed the issue you had in the example project, but the nugget still has the error in it and the project on this repo still has it.

@chrissainty Can you please help us move this forward when you get a chance.

reopened