Blazorise icon indicating copy to clipboard operation
Blazorise copied to clipboard

BarToggler Clicked only fired every second time when visibility is set to true

Open CPlusPlus17 opened this issue 2 years ago • 1 comments

Describe the bug BarToggler Clicked only fired every second time when visibility is set to true. This leads to confusing and non functional functionality on the click event, example: You want to do something on show/hiding changes. This only happend in mobile mode.

To Reproduce Steps to reproduce the behavior:

<BarToggler Clicked="@(_ =>Console.WriteLine("Called"))"/>

Switch into mobile view in dev console in the browser (device emulation). We start with a collapsed menu, first click to open it will output: Called, second click nothing, third click called, fourth nothing...

Expected behavior The Clicked event is execute every time.

CPlusPlus17 avatar Aug 21 '22 19:08 CPlusPlus17

I'm at the moment debugging, and I can confirm the same problem on my side. What I found strange is that @onclick inside of BarToggler is executed every time. But for some reason, when it invokes await Clicked.InvokeAsync(); the Clicked event is non existant. As if Blazor somehow removes it between states.

stsrki avatar Sep 13 '22 10:09 stsrki