Pagination on the Web is encapsulated magic and introduces usability cliffs #4
Labels
Area: CSS
Area: HTML
Area: JS
Issue: ergonomics
This is a web platform usability issue
Issue: performance
This gap makes the web platform slower
TAG consensus: ❓Unknown
The issue has been filed but not yet discussed in a meeting.
Currently, browsers implement functionality to paginate and print webpages, and provide limited control over this via the
print
media type and thebreak-*
(or the olderpage-break-*
) properties.However, this is all magic encapsulated in the browser implementation, and incredibly basic functionality is impossible to do, such as:
There are no easy workarounds, even via JS, the pagination algorithm is entirely encapsulated UA magic and authors have zero access to it. As a result, authors are forced to paginate content manually, which is how tools like Paged.js work. Given how complex pagination is, this is an incredibly fraught and slow process, especially for nontrivial layouts or modern CSS.
The use cases are not complex large projects such as document editors (though those definitely suffer too), but any nontrivial printing task, whether that is a content-heavy website that wants to also have a usable print style, or a document authored with web technologies.
Some proposals have been outlined decades ago in the CSS Paged Media and CSS Generated Content specs:
page
CSS counter that can be used wherever@bottom-right
) to print out page numbers and headers/footerstarget-counter()
to look up the value of a counter on a different element so that e.g. cross-references becometarget-counter(attr(href url), page)
leader()
functionHowever, there are multiple issues at play here:
As a result, these features have only been implemented by PDF formatters such as PrinceXML or AntennaHouse, i.e. specialized CLI tools that take an HTML document (+ associated resources) and spit out a PDF document. While in heavy use in many industries, including big publishing houses, PDF formatters are not a general solution. First, they lack the resources of browsers, and thus their CSS implementations often lag years behind and are more buggy than browsers. Being able to have page numbers or using CSS that shipped in the last decade should not be a mutually exclusive choice! But more importantly, there should not be a dichotomy about whether a document is only a website (and thus displayed in a browser) or only a printed document (and thus printed with a specialized print formatter). And there is something to be said about making printing with web technologies dependent on a non web platform technology such as PDF.
Clearly, UAs are not willing to implement these, or they’d have done it over a decade ago. We need to figure out of there is a minimum functionality that UAs would be willing to implement which could lower the pain and fragility of these tasks. Even a JS API that gives access to the UA’s native pagination algorithm would be a huge improvement over the current state.
The text was updated successfully, but these errors were encountered: