Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

associate OnClick to a task made the component wait for the task is finish to close itself #145

Open
julienGrd opened this issue Nov 23, 2023 · 1 comment

Comments

@julienGrd
Copy link

julienGrd commented Nov 23, 2023

Hello, i notice when i associate the OnClick to an async Task, the component wil disappear only when the task is finish, which make a very strange behavior to the user.

for example

<ContextMenuTrigger MenuId="indexMenu">
    <p>Right-click on this text to show a basic context menu sample</p>
</ContextMenuTrigger>

<ContextMenu Id="indexMenu">
    <Item OnClick="@OnClick">Item 1</Item>
</ContextMenu>

@functions{
    async Task OnClick()
   {
        await Task.Delay(30000);
   }
}

With this example, the context menu will disappear after 30s. The behavior is really strange, we have impression we click on nothing

Fot now the only workaround i have is to not await my event ( OnClick="@(async args => OnClick())" which generate warning in my solution.

There is a way to close it directly on the click ? thanks ?

@julienGrd julienGrd changed the title associate OnClick to a task made to component wait for the task is finish to close itself associate OnClick to a task made the component wait for the task is finish to close itself Nov 23, 2023
@Said1996
Copy link

Said1996 commented May 8, 2024

I had another bug but both needs one fix ... I have a situation where there is a button in context menu that remove item in a list ... if the item gets removed the context menu become opened on the next item (and no click around will remove that context menu) ... I guess he just need to close the context menu once any Action button is clicked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants