Whether you’re a fan of scripted ebooks or not, EPUB 3 has opened the door to their creation, so we’ll now take a look at some of the potential accessibility pitfalls and how they can be avoided.
One of the key new terms you’ll hear in relation to the use of scripting in EPUB 3 is progressive enhancement. The concept of progressive enhancement is not original to EPUB, however, nor is it limited to scripting. I’ve actually been making a case for many of its other core tenets throughout this guide, such as separation of content and style, content conveying meaning, etc. Applied in this context, however, it means that scripting must only enhance your core content.
We’ve already covered why structure and semantics should carry all the information necessary to understand your content, but that presupposes that it is all available. The ability for scripts to remove access to content from anyone without a JavaScript-enabled reading system is a major concern not just for persons using accessible devices, but for all readers.
And that’s why scripting access to content is forbidden in EPUB 3. If you try to circumvent the specification requirement and treat progressive enhancement as just an “accessibility thing,” you’re underestimating the readership that are going to rely on your content rendering properly without scripting. Picture buying a book that has pages glued together and you’ll get an idea of how excited your readers will be that you thought no one would notice.
Meeting the general requirement to keep your text accessible is really not asking a lot, though. As soon as you turn to JavaScript to alter (or enable) access to prose, you should realize you’re on the wrong path. To this end:
Don’t include content that can only be accessed (made visible) through scripted interaction.
Don’t script-enable content based on a reader’s preferences, location, language, or any other setting.
Don’t require scripting in order for the reader to continue moving through the content (e.g., choose your own adventure books).
Whether or not your prose can be accessed is not hard to test, even if it can’t be done reliably by validators like epubcheck. Turn off JavaScript and see if you can navigate your document from beginning to end. You may not get all the bells and whistles when scripting is turned off, but you should be able to get through with no loss of information. If you can’t, you need to review why prose is not available or has disappeared, why navigation gets blocked, etc., and find another way to do what you were attempting.