kobolabs / epub-spec

Details on the elements of the ePub spec that Kobo supports, as well as other information on the Kobo reading platforms.
Other
191 stars 20 forks source link

Support for Footnotes Using aside, epub:type="noteref" and epub:type="footnote"? #59

Open ourichermath opened 2 years ago

ourichermath commented 2 years ago

Could you please support footnotes using the aside tag with epub:type="noteref" and epub:type="footnote" across all platforms? I found references to use those, but it turns out they're only fully supported on ios. In Windows, using Calibre, they sort of work (aside doesn't hide), but on my Kobo Forma, after sideloading the epub3 book as a kepub, not only does the aside not hide, tapping the footnote number doesn't bring up a popup.

In the document text, I use the following to indicate a footnote:

<a href="#fn1" epub:type="noteref"><sup>n</sup></a>...</p>

and then after the paragraph, add the following for the actual footnote:

<aside id="fn1" class="footnote" epub:type="footnote"><sup>n</sup>...thenote...</aside>

From what I've read, I think the aside block should be automatically hidden in the ereader and tapping the footnote number in the text should popup the actual aside text. But, whether or not the aside block is automatically hidden, I'd at least like to see a popup.

According to my Forma, the Software Version is 4.33.19759 (5240404f16, 7/20/22).

ourichermath commented 2 years ago

Well, the footnotes as noted above in the very same book are now working (mostly) correctly. IOW, I now get the footnote text in a popup. I don't know what changed. Of course, the aside is still not hidden. But, again, I can live with that. I don't know if you want to close this or not since I'd still like to see asides automatically hidden (assuming that's the way they're supposed to work).

ourichermath commented 2 years ago

On my Kobo Forma, I'm also seeing that the popups generated with an aside-based footnote don't stop with the </aside> tag. Everything's nicely delimited on the actual book page. But, the popup continues showing text until (at least) a thematic break (i.e., <hr/> ).

EDIT: And, as to my previous comment about the popups working now, no. it's sporadic. Sometimes the popups will work and sometimes they won't. Same book, same css, same footnote. Sometimes it pops up. Sometimes it won't. If I wait some unknown amount of time, the behavior changes.

ourichermath commented 2 years ago

In an attempt to try getting the <aside> that do pop up as a footnote to actually terminate at the </aside> tag, I'm now wrapping the footnote text in paragraph tags. So, from source footnote to footnote text, it looks like:

...source paragraph...<a id="fn1" href="#fn1a" epub:type="noteref"><sup>n</sup></a>...rest of source paragraph...</p>

  <aside id="fn1a" class="footnote" epub:type="footnote">

    <p><a href="#fn1"><sup>n</sup></a>...the note....</p>

  </aside>

Unfortunately, it still doesn't work right. If the popup does happen (and I haven't been able to figure out what allows that), the footnote text in the popup just keeps going until it decides to quit.

Again, it works fine in the Calibre viewer. But, on a Kobo Forma as a kepub, it doesn't work correctly.

karlb commented 1 year ago

I don't think the asides are meant to be hidden automatically. But you can easily achieve that by putting the asides in a <div style="display: none">.

I have not tested footnotes extensively, but they work for me when using epubs that validate with epubcheck and then converting them to kepub.

I your last comment, epub_type should be epub:type.

ourichermath commented 1 year ago

Thanks for the note. I don't know what happened with the epub:type vs epub_type. It's correct in my template document. I've corrected it here. Regarding the display:none, I think I tried that (I can't remember at this point). The footnote became invisible alright. But, the footnote popup was also invisible. I'll have to give it another try and see.

wareid commented 1 year ago

Thanks for submitting this!

No update from me on what we'll do with <aside> but I did want to quickly note that using display:none would render the element invisible to the user and to assistive technology, meaning that screen reader users would be unable to see the footnotes at all. Not recommended.

hank commented 1 year ago

I also ran into this exact issue today. Please include a full working example here:

https://github.com/kobolabs/epub-spec#footnotesendnotes-are-fully-supported-across-kobo-platforms

I cannot get my hyperlink to either go to or pop up my aside footnote, and the aside isn't hidden. This is on an epub3 book. Please help.

ourichermath commented 1 year ago

If anything, this problem seems to be getting worse for me. I'd attach a little epub that I created that will show the problem, but I can't figure out how to do it. Here's a link to a thread on the the Kobo Mobileread forum where I've attached that document:

https://www.mobileread.com/forums/showthread.php?t=352480

AudreyLBE commented 1 year ago

If anything, this problem seems to be getting worse for me. I'd attach a little epub that I created that will show the problem, but I can't figure out how to do it. Here's a link to a thread on the the Kobo Mobileread forum where I've attached that document:

https://www.mobileread.com/forums/showthread.php?t=352480

Hi @ourichermath, not sure whether this is causing the problem but I did notice you're missing the doctype in the head of your xhtml files.

Should be:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en-us" xml:lang="en-us">

Yours is:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en-us" xml:lang="en-us">

Also you are missing the aria roles although not sure if that would matter for the display.

<a id="fn1" href="#fn1a" epub:type="noteref" role="doc-noteref">
<aside id="fn1a" epub:type="footnote" role="doc-footnote">

The "dcmodified" entry in the opf is also missing (again, I doubt that has anything to do with the notes, but epubcheck didn't like it, might as well make sure there is nothing else happening).

Everything else looks ok to me, could it be the doctype?

ourichermath commented 1 year ago

Interesting. It looks like Calibre (my epub manager/editor) strips out the DOCTYPEs. But, regardless, as best I can find (though I find nothing definitive), DOCTYPE is no longer required for epub3. But, I did add it in and it made no difference.

I think aria is totally independent of the footnote stuff (i.e., the epub:type="noteref" and "footnote" attributes).

I can find nothing about dcmodified, so I can't talk about it. But, neither the Calibre Editor's "Check Book" function nor the EPUBCheck addin have any problem with it not being there:

"EPUBCheck v5.0.0 Validating using EPUB version 3.3 rules. No errors or warnings detected. Messages: 0 fatals / 0 errors / 0 warnings / 0 infos"

wareid commented 1 year ago

The doctypes are not required. EPUBCheck is right (as usual).

I would recommend using the DPUB-ARIA properties as the latest revision of EPUB is recommending we move away from epub:type and the DPUB-ARIA properties are more likely to be implemented in browsers over time.

We will look into the footnotes issue mentioned though, thank you for the examples.

ourichermath commented 1 year ago

At:

https://www.mobileread.com/forums/showpost.php?p=4344117&postcount=6

jackie_w noted a rule for Kobo epubs that seems to have fixed my footnote problems. At its simplest:

"... make sure that there is a one-to-one relationship between HTML files in the epub and TOC entries in the NAV/NCX."

For the specific case of my sample booklet that I used as an example:

"1. You have one file, plays.xhtml, with 4 entries in the NAV/NCX. You can either reduce the NAV to a single entry of 'Plays' or split plays.xhtml into 4 parts with one NAV entry per part. Whichever method you prefer, do it for all the HTML files which currently have multiple NAV entries

  1. You have 2 files, Cover and Jacket which are currently missing from the NAV. Add them.
  2. You can leave the inline TOC, toc.xhtml, as-is because the Kobo sees it as "just another chapter" in the book, not its navigation system."

Looking at the modified file he attached to his post, every footnote popped up and displayed correctly (whereas none displayed correctly in my original file). I'll have to do some work on which of those specific rules were associated with this footnote problem. But, regardless, NAV/NCX one-to-oneness should have no bearing on footnote display. It's a place for Kobo to start looking, anyway.

jlhopes commented 1 year ago

I found this thread today in my search for an answer. I'm working on an EPUB, and my Kobo Clara HD will not link to the footnotes at the end of the chapter or display pop-up footnotes. The backlinks in the footnotes themselves do work, taking you back to the text, but the links to the footnotes within the text do not work. My formatting is just like that described in "My Sample Book", and I have checked that no HTML file is referenced more than once in the NAV file.

Any suggestions?

wareid commented 1 year ago

When you are testing the book, are you sideloading it to the device using the instructions mentioned in the document? The file should be sideloaded with the extension “.kepub.epub”.

Get Outlook for iOShttps://aka.ms/o0ukef


From: jlhopes @.> Sent: Thursday, October 5, 2023 3:47:39 PM To: kobolabs/epub-spec @.> Cc: Reid, Wendy @.>; Comment @.> Subject: Re: [kobolabs/epub-spec] Support for Footnotes Using aside, epub:type="noteref" and epub:type="footnote"? (Issue #59)

[EXTERNAL] This message comes from an external organization.

I found this thread today in my search for an answer. I'm working on an EPUB, and my Kobo Clara HD will not link to the footnotes at the end of the chapter or display pop-up footnotes. The backlinks in the footnotes themselves do work, taking you back to the text, but the links to the footnotes within the text do not work. My formatting is just like that described in "My Sample Book", and I have checked that no HTML file is referenced more than once in the NAV file.

Any suggestions?

— Reply to this email directly, view it on GitHubhttps://github.com/kobolabs/epub-spec/issues/59#issuecomment-1749543987, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB5NDKKDU5XXHCHD3B43R5DX54FFXAVCNFSM55S3CPKKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZUHE2TIMZZHA3Q. You are receiving this because you commented.Message ID: @.***>

jlhopes commented 1 year ago

When you are testing the book, are you sideloading it to the device using the instructions mentioned in the document? The file should be sideloaded with the extension “.kepub.epub”.

Thanks for your reply. This is the first I have heard about the kepub extension and Kobo having its own epub version, but it's good to know about. I tried changing the extension to ".kepub.epub" (and also using the Calibre plugin, which seems to do the same thing), and now the footnote links do indeed work, which is great. I also noticed that the fonts were scaled much smaller, and my embedded font (used only as secondary font) was ignored unless I chose "Publisher Default" for the font. Also, the "page-break-after:avoid" attribute was ignored, whereas it was not ignored when using the regular epub extension.

I still don't understand why the footnote links don't work when viewing it as a regular epub (ADE mode, I guess?). They work in ADE itself and on all other devices and apps that I have.