Bug <th> tag not a requirement for a html table

Language: HTML
Rule: Bug
Why: Unrequired tag
Product: Sonarqube

(from email_template.html hence the inline styling)

  <table style="
    width: 90%;
    max-width: 700px;
    background-color: #fff;
    border: 1px solid #CFD2D7;
    margin: auto;
    border-radius: 6px;
    padding: 50px;
    padding-bottom: calc(50px - 16px);
  ">
    <tr>
      <td>
        <h1 style="
          font-family: 'Blacker-Pro-Display';
Unexpected missing generic font family
          font-size: 32px;
          font-weight: 500;
          color: #0E1E36;
          margin: 0;
          margin-bottom: 30px;
        ">{{heading}}</h1>
      </td>
    </tr>
</table>

Hi,

Welcome to the community!

Thanks for this report. What version of SonarQube or SonarLint are you running? Or are you seeing this in SonarCloud?

 
Thx,
Ann

Sonarqube Community edition 9.6.1 Setting up latest currently, but work is interfering

Hi,

A lot gets updated from version to version. Can you see if this is still replicable once you’ve upgraded and let us know?

 
Thx,
Ann

I shall, once my virtual desk is less swamped! I checked another environment which is running vs 10 it still has wrong rules concerning the <th> element. Now the element is no longer required, but the scope and id are, which is untrue. it is true for the <header> element. Which RFC from the W3C are you using???

1 Like

Hi,

I don’t know. And I believe some of these rules were implemented a long time ago.

Could you provide a code snippet / reproducer for this, please? Because it’s not clear to me what you mean.

I assume scope and id are attributes, but of which tag?

 
Ann

The snippet I used at the beginning.

You need help with the HTML rule set?

Hi,

I’m confused. The snippet you used at the beginning demonstrated a lack of <th> tags.

When you don’t have scope and id attributes, issues are erroneously raised where in that snippet?

 
Ann

I think the table is a layout table rather than a data table, and in layout tables, th and other semantic elments must not be used.

Carl Gellings, Can you confirm that the example is a layout table? (Possibly something used to layout HTML mails?)

(Sorry, as a new user, I can’t ping anyone.)

1 Like