aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

<summary> / <details> Tag not working

Open uwefms opened this issue 8 years ago • 2 comments

Trying to use summary / details Tags produced the following error message: (in Firefox / Chrome)

Error: System.InvalidOperationException: Object of type 'ShowRaum.Client.Pages.Summary' does not have a property matching the name 'ChildContent'.

I know, it is not (yet) supported in Edge.

To reproduce:

Just add

<details>
	<summary>Some text</summary>
	<p>Another text</p>
</details>

to Counter.cshtml.

regards

  Uwe

uwefms avatar Jul 19 '18 17:07 uwefms

This is because you've defined a component called Summary, so it's trying to use that instead of a plain <summary> tag. You'll have to avoid naming components things that clash with HTML elements.

Eventually we should change the Razor compiler so it only matches components case-sensitively, as that eliminates this issue and is consistent with both HTML (idiomatically lowercase) and .NET (idiomatically uppercase) naming conventions. That's also the same as how React avoids this issue.

@rynowak Do you happen to know how much of a big job it would be to make the component tag helper matching be case-sensitive? I know that's not how Razor usually defines tag-helper matching.

SteveSandersonMS avatar Jul 19 '18 18:07 SteveSandersonMS

Thanks for your incredibly fast answer and sorry for wasting your time. Checked everything except component name ...

regards

uwefms avatar Jul 19 '18 18:07 uwefms