Validation Errors for HTML 5
Asked Answered
G

2

5

Validation errors

I'm getting a crazy set of errors. I'm using Bootstrap code and have not edited it. So why is this showing an error?

A link element with a sizes attribute must have a rel attribute that contains the value icon or the value apple-touch-icon.

Bad value banner for attribute role on element nav.

To see the same thing live, go to https://validator.w3.org/nu and enter: www.iqtests4kids.com/

Germany answered 30/12, 2016 at 6:19 Comment(0)
C
6

Maintainer of the W3C HTML checker (validator) here. The rel=apple-touch-icon-precomposed error is because I recently updated the checker to conform to HTML spec requirements for sizes:

The sizes attribute is used with the icon link type. The attribute must not be specified on link elements that do not have a rel attribute that specifies the icon keyword or the apple-touch-icon keyword.

About the error for role=banner on nav, that’s because the checker conforms to requirements in the ARIA in HTML spec that nav must not have any role other than navigation.

But note that the ARIA in HTML spec also states the following requirement:

Web developers should not set the ARIA role and aria-* attributes to values that match the implicit ARIA semantics defined in the table.

And requirements in “the table” cited state that the implicit semantics of nav are navigation.

Therefore, if you use role=navigation with nav, the checker will emit a warning.

So bottom line is, per the ARIA in HTML requirements, nav should never have an explicit role.

Carrew answered 30/12, 2016 at 15:57 Comment(0)
J
3

Looks like the Validator is happier with:

<link rel="apple-touch-icon".....

instead of

<link rel="apple-touch-icon-precomposed"......

And for the other error, you can make the Validator happy by altering the offending role="banner" setting to "role=navigation":

<nav id="main-menu" ..... role="navigation">

either leaving it in and living with the resulting 'Warning' or omit the value completely (the best solution) and the Validator will be happy :)

Jiggerypokery answered 30/12, 2016 at 7:3 Comment(4)
"the W3C has explicitly advised" — Please read the top of the page you quoted: does not necessarily represent consensus and it may have incorrect information or information that is not supported by other Working Group participants, WAI, or W3CEvetteevey
"As for Bootstrap: I am not familiar with this application" — It isn't an application. It is a template with some associated CSS and JS.Evetteevey
"it creates HTML and CSS either automatically or semi-automatically." — It doesn't.Evetteevey
@Evetteevey Thanks, I have pruned the incorrect assertions from my answer...Jiggerypokery

© 2022 - 2024 — McMap. All rights reserved.