readium-css
readium-css copied to clipboard
Defining design guidelines based on CSS support
I'm submitting a topic for discussion, which goal is to agree on design guidelines that can help make choices and take resolutions.
Short description of the issue/suggestion:
While we did our best to address EPUB Compatibility through documentation, we didnât necessarily address what ReadiumCSS should do in regards to web/engine/platform compatibility.
It was acceptable to handle things on their own a few years ago e.g. hyphenation was not available in Chromium/Blink on Linux nor Windows, but that didnât prevent us from using it in ReadiumCSS, especially as itâs kinda critical for published works. With new specs and updates of existing ones, itâs become a little bit more difficult though. My hope is that design guidelines or rules may help keep ReadiumCSS more consistent.
As usual with CSS, things are not as clear-cut as with other languages, mainly because if the rendering engine doesnât support something, it doesnât break or err. Iâll try my best to make it as clear as possible.
- what should we do with non-standard properties i.e. vendor-prefixed properties that are not on the standardisation track?
- is progressive enhancement desirable, or should we keep it the most consistent possible by targeting the common denominator/baseline?
Non-standard props
There isnât a lot of such properties in ReadiumCSS, fortunately, but they may end in self-inflicted pain. Such is the case in #113, with a webkit property in safeguards, to protect against raised capitals (initial letter that is bigger but not dropped) w/o a specified line-height. That is consistent with iBooks.app, but creates an inconsistency in ReadiumCSS-based apps across platforms. In hindsight maybe it would be preferable to remove it, and keep things consistent in the Readium ecosystem.
Worse still, in terms of consistency, it is difficult to explain why this is present in ReadiumCSS, but -webkit-column-axis and
-webkit-column-progression arenât, while they could help with issues such as #96.
Proposed Resolution: I guess this is something we can create a design rule for e.g. âDonât use props that are not on track to become standard.â
Progressive enhancement
This is probably going to be more of a range â What is preferable? â than picking between 2 options â Y/N â since we wouldnât have hyphenation in the first place.
Iâve started sharing an overview of new and updated specs in #137 and itâs kinda obvious there may be useful features we could use, but they are obviously supported from specific versions of each rendering engine, which comes with its own set of issues:
- it creates extra rendering inconsistencies on the same platform, using different versions;
- it may create noise for implementers in the form of additional bug reports;
- it may solve issues but only for the latest versions;
- probably more I canât tell off the top of my head.
On the other hand, that could also help future-proof ReadiumCSS, which is not an insignificant positive.
Proposed Resolution: that probably canât be a rule, but rather a process i.e. documenting how it could help, what the impacts would be, discussing/voting, and explaining why it was used or not. However, there is probably a way to narrow things down a little bit, before entering this process phase â which sounds extensive and wouldnât make things really efficient if we have to discuss everything.
Maybe restricting progressive enhancements to minor bugs, or targeting a max version of engines in addition to the min version (see #131). Iâm open to ideas and othersâ point of view here.
I agree that there's value in a consistent base Readium CSS distribution. Maybe the progressive enhancement could be some kind of opt-in as separate stylesheets, similar to the EBPAJ fonts patch?
As usual with CSS, things are not as clear-cut as with other languages, mainly because if the rendering engine doesnât support something, it doesnât break or err.
I know that you have a test suite in the repo. Is there a way to run them automatically? That could be super helpful to have automated tests with screenshot diffs, running on a device farm like BrowserStack to test many different browser in one go.
https://medium.com/seminal/useful-css-regression-testing-tools-99f09a7b8e4c
Maybe the progressive enhancement could be some kind of opt-in as separate stylesheets, similar to the EBPAJ fonts patch?
Some features could make their way into an âexperimentalâ stylesheets of sorts, in order to give implementers an âopt-inâ mechanism. Iâm still unsure what it could contain though, as it depends on fixes and new features.
Itâs also worth noting that since itâs inconsistent by design, CSS offers a mechanism to test for support and style accordingly, at supports. So basically the logic is something like the following in pseudo-code:
if (supports CSS feature X) {
use these styles
} else {
use these other ones
}
But, itâs been obviously designed for authoring, not rendering/overriding. So while it could be useful in a handful of cases, it would mainly be used for issues and features which donât impact implementation directly I guess â otherwise itâs a footgun.
This is not a strategy I would use for https://github.com/readium/readium-css/issues/138#issuecomment-2074358015 for instance, as it would impact pagination in nasty ways, considering how immature implementation is and the requirements it forces upon implementers â changing how they handle overflow in vastly different manners depending on whatâs supported.
So I guess time (and fixes and feature requests) will tell whatâs best in that regard. Itâs an option for sure, and itâs good to have.
I know that you have a test suite in the repo. Is there a way to run them automatically?
Iâll have to take a look.
Weâre using Backstop.js, which relies on node, Chrome Headless + Playwright or Puppeteer scripts. So itâs unlikely it can work out of the box with BrowserStack.
That said, the test suite is basically made of webpages loaded w/o any interaction so itâs not like it would be a pain to migrate at least this part.