Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headings: HTML5 vs HTMLBook #215

Open
dac514 opened this issue Nov 22, 2017 · 1 comment
Open

Headings: HTML5 vs HTMLBook #215

dac514 opened this issue Nov 22, 2017 · 1 comment

Comments

@dac514
Copy link

dac514 commented Nov 22, 2017

We hope to start using HTMLBook in a WordPress application where everything in between <div class="content"> tags is generated by WordPress.

This document is valid HTML5:

<!DOCTYPE html>
<head>
    <title>HTMLBook Sample</title>
    <meta name="HTMLBook Sample" content="text/html; charset=utf-8"/>
</head>
<body data-type="book" class="book" id="htmlbook">
<section data-type="chapter">
    <header>
        <h1>HTMLBook</h1>
    </header>
    <div class="content">
        <h1>WordPress Post</h1>
        <p>The User Is Doing Things</p>
        <h1>WordPress Post</h1>
        <p>The User Is Doing Things</p>
    </div>
</section>
</body>
</html>

(Tested here: https://html5.validator.nu/)

The same document with an extra:

<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	  xsi:schemaLocation="http://www.w3.org/1999/xhtml ../schema/htmlbook.xsd"
	  xmlns="http://www.w3.org/1999/xhtml">

In the header is not valid HTMLBook. It complains about the second <h1>

element h1: Schemas validity error : Element '{http://www.w3.org/1999/xhtml}h1': This element is not expected."

I understand why it is invalid in HTMLBook but... the HTML5 spec "encourages" authors to use "headings of the appropriate rank" instead of h1 everywhere. An encouragement is not a normative requirement.

Is there something we can do to loosen the headings validation between a given div tag?

@caraya
Copy link

caraya commented Nov 23, 2017

div is not a new container element. The spec says this about div:

Authors are strongly encouraged to view the div element as an element of last resort, for when no other element is suitable. Use of more appropriate elements instead of the div element leads to better accessibility for readers and easier maintainability for authors.

Maybe change it to section, aside or article if you have a choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants