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

[Bug Report] The click event of Menu activator prevents the @onclick event #2284

Open
capdiem opened this issue Dec 16, 2024 · 1 comment
Open

Comments

@capdiem
Copy link
Contributor

capdiem commented Dec 16, 2024

Masa.Blazor version

v1.8.1

Hosting model

Blazor Server

Describe the bug

#2106 resolved the problem where the OnClick event wouldn't trigger when using the MButton and MMenu together, but it also affects other components, including but not limited to the ListItem component and elements using the native @onclick.

For components of MASA Blazor, the previous approach can be used to resolve the issue, but there's not much that can be done for the native elements' @onclick. We need to find a more suitable solution.

Expected Behavior

No response

Steps To Reproduce

No response

Reproduction code

<MMenu>
    <ActivatorContent>
        <MListItem OnClick="@(() => Click("ListItem"))"
                   @attributes="@context.Attrs">ListItem</MListItem>
    </ActivatorContent>
    <ChildContent>
    </ChildContent>
</MMenu>

<MMenu>
    <ActivatorContent>
        <button @onclick="@(() => Click("origin button"))"
                @attributes="@context.Attrs">origin button</button>
    </ActivatorContent>
    <ChildContent>
    </ChildContent>
</MMenu>


@code {

    private void Click(string name)
    {
        Console.WriteLine($"Clicked {name}");
    }

}

.NET version

No response

@capdiem capdiem added this to the 1.9.0 Planning milestone Dec 16, 2024
@capdiem
Copy link
Contributor Author

capdiem commented Dec 16, 2024

It seems to be a bug related to the issue discussed in dotnet/aspnetcore#59499

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

No branches or pull requests

1 participant