Skip to content

Commit

Permalink
#789 HxContextMenuItem does not stop click propagation - repro test
Browse files Browse the repository at this point in the history
  • Loading branch information
hakenr committed Apr 16, 2024
1 parent ab0429d commit b205c19
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions BlazorAppTest/Pages/HxContextMenu_Issue789_Test.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@page "/HxContextMenu_Issue789_Test"

<h3>HxContextMenu_Issue789_Test</h3>

<HxAccordion StayOpen="true">
@foreach (var word in words)
{
<HxAccordionItem>
<HeaderTemplate>
<HxContextMenu>
<HxContextMenuItem Icon="BootstrapIcon.Trash" Text="Remove this word" OnClick="@(() => RemoveWordFromList(word))" OnClickStopPropagation="true" />
</HxContextMenu>
@word.Name
</HeaderTemplate>
<BodyTemplate>
<HxInputText Label="Word" @bind-Value="@word.Name" />
</BodyTemplate>
</HxAccordionItem>
}
</HxAccordion>

@code
{
public class WordDto
{
public string Name { get; set; } = string.Empty;
}

private List<WordDto> words = new() { new WordDto { Name = "test" } };

private void RemoveWordFromList(WordDto word)
{
words.Remove(word);
}
}

0 comments on commit b205c19

Please sign in to comment.