readium / readium-css

🌈 A set of reference stylesheets for EPUB Reading Systems, starting with Readium Mobile
https://readium.org/readium-css/
BSD 3-Clause "New" or "Revised" License
90 stars 20 forks source link

`background-color` is not being respected from author styles #27

Closed jccr closed 4 years ago

jccr commented 6 years ago

I found an EPUB that has a stylesheet using the selector html

example_author_styles.css =

html {
    background-color: #fffeee;
}

With the regular stacking of ReadiumCSS this author style doesn't seem to be respected because of this line https://github.com/readium/readium-css/blob/f432927e6aadfc1f86e9266f4c87202f52c401b2/prototype/src/ReadiumCSS-base.css#L42

The !important is what's stopping it

@JayPanoz Is this intentional?

JayPanoz commented 6 years ago

Ah yeah so at the moment, it is indeed intentional. As far as I can remember, we hit some edge cases quickly with some samples, in which authors put a sepia background for instance, and the “day theme” was therefore becoming useless and confusing – feels like a bug.

On a related note, neither users not authors/publishers seem to be really happy when background-color for the html element doesn’t cover the entire screen/browser window and is only covering the iframe or webview. That was indeed quite a popular feature request from the e-production community when I run some surveys/drive discussions to list their issues/requests.

So I don’t have any solid guidance for this case yet. Maybe this snippet will change at some point but we’ll have to fix the UX issues first.

Everything related to reading modes is kind of nightmarish since there are a lot of CSS hacks which can go wrong out there. So to be honest the current implementation tries to get around those issues in the simplest ways I could find. In any way, the “day mode” should work as expected, so it probably means creating a “publisher reading mode” (with a default in case background-color + color are not declared).

Moreover, reading modes are part of “Chrome” in our current classification, see issue #16. What it means is that, like pagination/scroll, it is a basic setting that should always work the same for the user and never break her/his expectations, whatever it takes. So I’m obviously open to discuss our options since it puts a burden on authors.

JayPanoz commented 4 years ago

Superseded by #46 so we should probably discuss this topic in the other issue.