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

Is the ToC really a flat ordered list of resources? #8

Open
frivoal opened this issue Jan 18, 2018 · 1 comment
Open

Is the ToC really a flat ordered list of resources? #8

frivoal opened this issue Jan 18, 2018 · 1 comment

Comments

@frivoal
Copy link
Contributor

frivoal commented Jan 18, 2018

The spec says the Table of Contents is build out of non hidden hyperlinks under <nav role=doc-toc>. But what is it exactly, and what is it used for. the spec says this:

User Agents can use the Table of Contents for example to provide the user with an ordered collection of resources he/she can directly navigate to on demand.

That seems a little too simple, as Table of Contents often have structure and hierarchy, and this definition forgoes that.

<nav role=doc-toc>
<ol>
  <li><a href="...">Tome 1</a>
    <ol>
      <li><a href="...">Ch1.1</a>
      <li><a href="...">Ch1.2</a>
  </ol>
  <li><a href="...">Tome 2</a>
    <ol>
      <li><a href="...">Ch2.1</a>
      <li><a href="...">Ch2.2</a>
  </ol>
</ol>
</nav>

This would be turned into a linear list: Tome 1, Ch1.1, Ch1.2, Tome 2, Ch2.1, Ch2.2. In this example, the list is short and the names reflect the hierarchy, so it is not too bad, but for a larger document it would not be very usable.

So, I think the ToC should not be a list, but it should be a tree. That way, the UA could still present a flat list if it wanted to by flattening the tree depth first, but it could also (and probably should) present it as a hierarchy, possibly with some UI to collapse sub-levels...

For example, here is a screenshot from a long & structured PDF I happen to be reading. A WebBook UA should be able to do a similar rendering of the ToC.

screenshot 2018-01-18 16 51 53

For this to be possible and interoperable given arbitrary markup, we need to define the precise algorithm to go from the DOM to the ToC tree.

I'm happy to write this in precises language if we agree on the general approach. As a general approach, I suggest:

  1. <ol>, <ul>, <dl> increase the level of nesting, nothing else does
  2. within one level of nesting all non hidden links go in document order

Possible alternative to 1: <ol>, <ul>, <dl> and sectioning content elements (article aside nav section) increase the level of nesting, nothing else does. I don't think I like this alternative, but I thought I'd just put it there for the sake of the discussion.

@therealglazou
Copy link
Owner

This clearly collide with issue #7 and my comment there.

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