Skip to content

Data-* attribute throws "Attributes may only be added immediately after frames of type Element or Component" #10897

Closed
@ZergZe

Description

@ZergZe

Describe the bug

Getting "InvalidOperationException: Attributes may only be added immediately after frames of type Element or Component" when add data-* attribute together with onclick handler on the same element:

To Reproduce

@page "/counter"

<p>Current count: @currentCount</p>

<button data-test=@("test") onclick="@IncrementCount">Click me</button>

@functions {
int currentCount = 0;

    void IncrementCount()
    {
        currentCount++;
    }
}

Expected behavior

...
<button data-test="test" ...
...

Hope this will help when release, but not sure.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions