Adequately marked up <a href="..." epub:type="noteref"> footnotes (actually called endnotes) are rendered nicely in epub readers like the Kindle: clicking on one opens it in a scrollable modal. I've seen some desktop ereader software render them as page footnotes.
And since they are basic links, they work in a PDF and of course on a web page without any extra work on your part. Jumping isn't that great (and endnotes should always have a jumpback link) but it's not a bad baseline impl.
I think following the endnote + noteref epub spec is the way to go.
How they actually get rendered, like putting them inline, is then a trivial concern for the reader software.
I personally like the modal overlay approach that some readers do. It handles endnotes of unlimited length and lets them be arbitrarily complicated since the modal is basically just an inset page. For example, a downside of inline footnotes is what should be done when they are too long to fit on the remainder of the page? Do you scroll next-page until you finish reading it, then prev-page back to where you started? etc. Either way, seems ideal to leave that concern to the reader software.
You cannot use details inside p. Only phrasing content is allowed and details is not one of them. So, it would be valid for some rendering engines to implicitly closes the paragraph at this point.
On the contrary, XHTML was stricter. If you put an element where it’s not supposed to be, the whole document would (probably?) not render.
But the point is moot: XHTML is completely dead, lacks newer HTML elements like <details>, and no browser includes an XHTML parser anyway—they’ll use the HTML parser.
It's rendered properly in Chrome. If some XML is wrong, it'll error. So at least Chrome supports XHTML with strict XML validator. And <detail> tag works as expected and it's even nested inside <p> tag in DOM.
That XHTML won't pass validator.w3.org (<details> can't be inside <p>), but Chrome does not care.
Huh, I thought the XML serialisation of HTML had been evicted from all the browsers, but you’re right, and Firefox behaves the same way. https://html.spec.whatwg.org/#html-vs-xhtml describes briefly what is expected to occur (though that section is non-normative). Also given that I know that browsers can successfully load XML documents with XSLT (I’ve seen one or two web pages that actually do this), and that I know that the XML parser is accessible via DOMParser (this can be useful for some kinds of markup sanitisation), I’m not sure why I thought XHTML was completely dead in this way. Something’s niggling at the back of my mind, but I can’t place it.
I believe browsers would be quite within their rights to do DTD validation and consequently reject such a document as this, but they don’t actually do so. (Even if the DTD is specified correctly for XHTML 1.0 Strict, nothing changes.)
Thanks for correcting me. I have updated my mental knowledge repository.
> I’m not sure why I thought XHTML was completely dead in this way. Something’s niggling at the back of my mind, but I can’t place it.
Browsers were always non-validating XML processors. Maybe you're thinking about the Well-formedness constraints? These constraints check if an XML document follows the XML metasyntax and any XML processor is required to fail [1] on errors in these contraints. And browsers do that.
In practice most well-formedness violations were nesting errors like missing start or end tags, common when generating XML via text concatenation or templates, which in the dark times a lot of people do, even when they shouldn't . [2] That's why the HTML5 parsing algorithm is so complex and almost unimplementable. It's the ambition for error correction: It tries to generate a DOM out of any well-formed and unwell-formed documents.
Yes - I have cheated with my markup by just putting the text inside the body without p. It is valid in a div. Like I say, this is a terrible way to do it!
This doesn't sit well, to me. I think it makes more sense to use `<sup>`s and `<a href>`s that point to `<a id>`s inside a `<footer>`. I think this conveys the meaning better.
That's not to say the displayed technique is "wrong". It's interesting, clever, and a great exploration of the semantics.
href footnotes are a usability disaster in my experience. Many (most?) don't have a jumpback link, and when the link is too close to the edge of the page it gets overridden by the prev/next page control. I've ended up giving up on reading footnotes in ebooks. If it weren't for coronavirus library closures, I would read a small fraction of the ebooks that I read right now.
Yup - that's how most ePubs do it now. Currently, eReaders handle that inconsistently. Some jump you down to the footnote and others display it on the same page.
I don't know about using it for footnotes, but this seems a great way to handle spoilers natively in movie/tv related sites with user generated content.
I feel we should not have carried over superscript formatting from print to CSS/HTML/ePub. It makes no sense to create such tiny links that are difficult to click or tap. (It's fine to keep the semantic meaning of the tag, but format it so that is not so small.)
Size of visual cue and size of hit target should not be conflated. In terms of visuals, it is a good idea for the marker to be presented as unobtrusively as possible.
To me footnotes/endnotes exist as the least bad way of working with supplemental information within the constraints of the _printed_ page (i.e. it can't be dynamically re-rendered).
I want my electronic documents to do it better, with true re-rendering and inline/overlay display on demand. But it is partly a matter of taste, and there is also something to be said for a degree of skeuomorphism.
In the example, only the second footnote should even be a footnote - the other two should be endnotes. Citations should be endnotes, while asides, parentheticals, and other bits that someone might actually care to read should go in footnotes.
Unfortunately, few styles actually dictate this. I remember one anthology from my undergrad days which handled things perfectly: side notes for vocabulary notes (it was an anthology of older English literary texts), footnotes for commentary, end notes for text source notes (there weren't really citations per se so much as indications about where the anthologized text came from and choices about which edition/manuscript was followed for the text).
I love using footnotes and sidetone in my writing and I have had this frustration myself.
Part of the problem with footnotes is that they must be rendered in completely different ways depending on the device. It is annoying that there really isn't a good way of expressing that something should be a footnote attached to a particular piece of text in HTML. Depending on the stylesheet, this should be rendered as an expandable in-line span, a floating block off to the side, or a footnote at the bottom of the document or printed page (for printouts or PDFs).
My website uses a modified version of the tafte.css project, which meets _some_ of requirements in a sort-of hacky way.
In e-text, jumping down to read a footnote, then back up again is a hilarious anachronism that gets old really fast. Ted Nelson groan.
The tack that Wikipedia has taken ... hover over the note# and a floating box reveals the note (and any links) ... IMO is state-of-the-art. I hate wasting time making stuff 'pretty print' - time that could have been much better spent improving the content instead of mere aesthetics.
While the world catches up with WPedia, this 'details' method has a lot going for it.
I had no idea there was a native be [open] CSS selector. It's the first time I hear about details too. Idk if that's a useful was to do footnotes, but I learned something today
Only the details element has the open attribute so you wouldn't hear about using it in CSS without hearing about it. BTW, you can use JavaScript to expand/collapse the element by setting and removing the attribute.
A downside to details/summary for footnotes is you can't find the footnote text in page using Cmd/Ctrl+F.
"Disclosure widgets" are a common pattern on the web so it's good that there's an HTML-native form of them. Two reasons why they're not used more is 1) they're HTML5 so IE didn't support them (neither did Edge before Chromium) and 2) the transition isn't currently animatable.
Thanks, I was just going by the note on the MDN page.
I tried changing your example to have the transition be on the <detail> element itself instead of the child <p> but it didn't work, maybe that's what the MDN note is about.
https://m8y.org/tmp/testcase491.xhtml transition on <detail>
And, yeah, the main "trick" is that it's tough to animate a height when the content is variable height. Thus the max-height and tweaked animation curve trick. But for many cases you'd probably want fixed height with scroll anyway.
Just be sure to use a keyframe to turn off the scroll when animating or it looks awful.
As I attempted to explain in the linked blog post - different eReaders render these sorts of links differently. Some link to the bottom of the page, some don't provide backwards navigation, some pop-up modals, some modals overflow.
This was designed to be an experimental way of doing in-line notes.
As per the title, it isn't a particularly great way of dong it. But I thought it was interesting.
Ahh, I guess I should have been more specific. I can also select the footnote toggles by tabbing, and toggle them with the keyboard. But can’t select them in a random-access way with link hinting (I mentioned vimperator), because they are not links nor something else, such as an input field, that gets a hint. So that's a slight advantage on the side of using some kind of link for the footnotes. But really, this just shows me that link-hinting systems should include detail toggles as targets.
And since they are basic links, they work in a PDF and of course on a web page without any extra work on your part. Jumping isn't that great (and endnotes should always have a jumpback link) but it's not a bad baseline impl.
I think following the endnote + noteref epub spec is the way to go.
How they actually get rendered, like putting them inline, is then a trivial concern for the reader software.
I personally like the modal overlay approach that some readers do. It handles endnotes of unlimited length and lets them be arbitrarily complicated since the modal is basically just an inset page. For example, a downside of inline footnotes is what should be done when they are too long to fit on the remainder of the page? Do you scroll next-page until you finish reading it, then prev-page back to where you started? etc. Either way, seems ideal to leave that concern to the reader software.