dotnet / dotnet/aspnetcore

Cannot pass through directive attributes, so components can't support @on{EVENT}:stopPropagation etc.

Open
#20,560 21 comments 10 reactions 0 assignees View on GitHub
affected-most area-blazor enhancement feature-blazor-component-model feature-rendering severity-major
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is your feature request related to a problem? Please describe.
This feature relates to https://github.com/dotnet/aspnetcore/issues/18460 where I'm building a custom styled component and want to keep all features for a simple tag, eg:
```Razor


@ChildContent

@code {
[Parameter(CaptureUnmatchedValues = true)]
public IDictionary? AdditionalAttributes { get; set; }
}
```
where, `@boxClass` is generated somewhere else. All attributes works except the `@on{EVENT}` in combination with `@on{EVENT}:stopPropagation` and/or `@on{EVENT}:preventDefault`.

### Describe the solution you'd like
I'd expect that if I'm able to pass down the event handler it should be possible to pass the event custom attributes also since it's not practical (could be for a workaround) to have two flags for each possible event and declare them into the component.

### Additional context
None

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.