Hidden attribute in Navigation Document

6 posts / 0 new
Last post


I'm building an EPUB 3 editor. I'm currently focusing on management of Navigation Document and I need your help in a particular domain.

I won't explain the composition of EPUB 3 navigation, I guess most of you have a certain knowledge on this subject.

In Matt Garrish Book "EPUB 3 best practices", as in the EPUB 3 specification, the hidden attribute, which is used to hide entries in the navigation document, seems to be applicable only to <ol> tags.

(In the EPUB specification, I've seen an hidden attribute on nav level).

My question : is it "legal" to apply hidden attribute to <li> tag, or we could just add it in <ol> tag and eventually <nav> tag ?

Thank you.

The current HTML5 draft notes 'All HTML elements may have the hidden content attribute set.'

EPUB 3 only notes, that has no effect, if such a 'hidden' fragment is used/interpreted as the navigation document (replacement for the old NCX), therefore this may only have an effect, if the document is used as well as a normal content document. This is similar to the effect, that the ol list numbers should not appear, if such a fragment is used as a navigation document.

It's not that it is only legal on the list elements, but for the purposes of hiding content it typically only makes sense to hide an entire sub-branch, so that's all I was showing in the book. You could use it on a list item, but it's an odd choice to remove an individual sibling entry. It makes no sense on the a elements and below, but it's not illegal, as only the content model is restricted (I personally think it's a bug not to restrict use of @hidden, at the lower levels, but it's not required to do so when the attribute is ignored in all cases).

The key take-away is more that the hidden attribute has to be ignored when rendering the navigation document outside of the spine. It's a deviation from pure HTML rendering, just like having to remove the list numbers when generating outside the spine, as OH notes.

You can also use the attribute for in-spine rendering to hide the page list, landmarks and other specialized nav elements you don't want to display to the reader, but if a reading system were to ignore them outside the spine there would be no way to use the document for the two purposes without a lot of ugliness.

In the book I believe I mentioned that it can be used to indicate collapsed branches in a out-of-spine custom view, but that was always debatable, and I ultimately lost the debate on a strict reading of the spec which requires no such behaviours. The reading system doesn't have to take the presence of the attribute as having any meaning outside the spine.

Also, if it helps, basically ignore the parts about stripping the hidden attribute from in-spine rendering when looking at that chapter. That was what led me to file a bug against the spec to clarify which rendering @hidden was intended to influence. My understanding coming out of 3.0 was that it could be used to hide rendering out-of-spine (e.g., collapse so that an AT user could still reach all the branches), but only optionally in-spine.

If you reverse the interpretation, which is ultimately what was ruled correct, the attribute allows a reduced table of contents in-spine and has no impact on the full table of contents out-of-spine. In that scenario, you'd never be stripping @hidden from in-spine, since that's all it's designed for.

Anyway, the moral of the story is that errors can get through even expert reviews, as this got out to print before I started questioning it. In my defence, the nav document was replacing the NCX, which was never used for in-spine rendering, so the goal of avoiding reduced tables of contents by allowing collapsing never struck me as an in-spine only need. But it pays to never assume...

OK, thank you for your explanation.

To summarize :

- It's not illegal to hide a single entry, but it doesn't make sense.
- In specialized view : I don't care the hidden attribute
- In embedded view : should take into account hidden attribute (in fact, the HTML rendering engine takes care of it).

Thank you.

Right, you don't do anything special if the document is included in the spine. It's just another content document.

The hidden attribute use is detailed in section of the Content Documents specification if you want the official reference, but the key sentence is:

The hidden attribute has no effect on how navigation data is rendered outside of the content flow (such as in dedicated navigation user interfaces provided by Reading Systems).

So, your summary is correct.

Secondary menu