# Web:S6836 not recognising contained elements

**URL:** <https://community.sonarsource.com/t/web-s6836-not-recognising-contained-elements/176949>\
**Category:** Report False-positive / False-negative...\
**Created:** [January 28, 2026, 10:11am UTC](https://community.sonarsource.com/t/web-s6836-not-recognising-contained-elements/176949 "2026-01-28T10:11:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc.free](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@marc.free](https://community.sonarsource.com/u/marc.free)\
**Post date:** [January 28, 2026, 10:11am UTC](https://community.sonarsource.com/t/web-s6836-not-recognising-contained-elements/176949/1 "2026-01-28T10:11:37Z")

</div>

Tell us:

- What language is this for?

C# / CSHTML / Razor

- Which rule?

Web:S6836 : label elements should have a text label and an associated control

- Why do you believe it’s a false-positive/false-negative?

Code (see below) contains additional elements. This is in accordance with the rule description which states:

> [HTML static code analysis](https://rules.sonarsource.com/html/RSPEC-6853/)  
> Custom components may contain control elements, therefore label elements containing custom elements do not raise issues.

(this is typical where you have label\>checkbox)

- Are you using
  - SonarQube Server

2025.4

- How can we reproduce the problem?

```auto
<label>@Html.RadioButtonFor(model => model.AllOptions, true, new { id = "AllOptions_True" }) All Options</label>

```

the label contains a Razor radio button, so matches the exception detailed in the documentation

---

<div class="post-metadata">

**Author:** ![victor.diez](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/victor.diez/32/38525_2.png) [@victor.diez](https://community.sonarsource.com/u/victor.diez)\
**Post date:** [January 29, 2026, 10:45am UTC](https://community.sonarsource.com/t/web-s6836-not-recognising-contained-elements/176949/3 "2026-01-29T10:45:39Z")

</div>

Hello @marc.free,

thanks for reporting this. Indeed it’s a false positive. I created a [ticket](https://sonarsource.atlassian.net/browse/SONARHTML-345) to fix it.

Cheers!
