-
Notifications
You must be signed in to change notification settings - Fork 22
Description
User settings are a complex issue because overrides are hard.
Some user settings are all or nothing, others might be raw around the edges, and so on and so forth.
I like to think of user settings as two conflicting intents: the user’s and the author’s.
Although the user’s intent must often win, we can at least polish some details.
The aim of this comment is to kickstart the discussion. It may be wrong in some places, I possibly owe you clarifications here and there, etc. but the main goal is to help implementers make informed decisions about those user overrides.
Managing conflicts
We’re referring to the W3C’s priority of Constituencies there. In other words:
Users’ styles > Authors’ styles > Implementers’ styles
Which is why conceptualizing this issue as intents may help.
Typography is not just a set of settings though, it’s a complex system in which some settings impact other settings. For instance, font-size impacts line-height and line-length, which impacts the number of columns.
It is up to implementers to pick their preferred approach (minimal set, presets, minimal set/presets with advanced settings, maximal set) since it is primarily an UX issue.
!important
User’s intent
Does not apply.
Author’s intent
In theory, using !important
is a clear intent the author is willing to enforce some specific style.
What do do
In practice, !important
may be abused, it may be a quick fix to solve a cascading issue—and the author didn’t bother taking Reading Systems into account—, it may be used to enforce some styles in Reading Systems overridding any style, etc.
This case is a complex one. We’re designing Readium CSS with the minimum amount of overrides possible but !important
may conflict with some user settings. Please refer to the following cases.
Font family (typeface)
User’s intent
The user intends to at least override the typeface used for body copy.
For a11y-related typefaces (Open Dyslexic, bold style of sans-serif family), the user probably intends to replace headings, scripts and italics as well.
Author’s intent
Declaring a font-family
for body
or p
+ p.class
is so common that it should not be considered an intent per se. While p.class
is debatable, it is so widespread in practice (some authoring tools output font-family
for every paragraph style) that it can’t be considered an intent in pure CSS.
A different font-family
can be set for headings (h1
, h2
, h3
etc.), blockquote
, i
, span
, etc.
What to do
A different font-family
for specific elements should be considered a proper intent: a font may indeed be used to make the structure clearer, achieve visual effects (e.g. manuscript letter) or make sure different languages are displayed correctly.
For a11y-related settings (e.g. Open Dyslexic), you should override those elements too, as not doing it will impact the reading experience negatively. Please make sure to provide a font-stack that covers a large amount of different languages though.
In any case, math content should not be overridden.
Font size
User’s intent
The user intends to adjust the font-size, either because it is too small or too large by default.
Author’s intent
This may be considered an intent if a font-family
is set for body copy.
What do do
The author could be trying to compensate for a smaller or larger x-height.
You might want to normalize font-size
(à la iBooks) if the user changes the typeface.
Line height (leading)
User’s intent
The user intends to adjust line height, either because it is too solid or too loose by default.
Author’s intent
The author may be trying to enforce vertical rhythm but you really can’t tell if you don’t analyze the entire stylesheet.
What do do
Common elements for the body copy should be overridden (paragraphs, lists…).
Text align (justification)
User’s intent
The user intends to set a personnal preference. Although it is a bad practice in typography, some may prefer justified text without hyphenation.
Author’s intent
If set for body copy, this is a publisher’s or author’s preference.
If explicitly set to right
and center
for paragraphs, to which left
is added for headings, it is a clear intent.
What do do
Clear intents should not be overridden. This may require JavaScript though.
Elements such as headings, tables, pre, etc. should not be overridden: declaring text-align: justify
for those elements would indeed degrade legibility.
Hyphenation
User’s intent
The user intends to enable/disable justification, possibly depending on the default/author’s styles.
Author’s intent
Since hyphenation works in combination with justification in proper typography, this should be considered a preference or the enforcement of a typographic rule.
What to do
Typography-wise, it is OK to hyphenate body copy with text-align: left
, it is critical to hyphenate body copy with text-align: justify
.
We are taking care of elements which should not be hyphenated in the patch stylesheet so that you don’t have to.
Number of columns
User’s intent
The user intends to set a personnal preference. They may be used to reading newspapers, where the column length is quite small, but that can create extra issues on the implementers’ side.
Author’s intent
Does not apply to authors.
What to do
It depends on the implementers’ approach (presets with typographic rules as references Vs. the user can override on a setting-by-setting basis).
Margins
User’s intent
The user intends to adjust line-length.
Author’s intent
We have to override margins for pagination so the most important style is max-width
, if set.
What to do
The author intends to limit line-length, but it is unclear they are doing it because some Reading Systems don’t or because they want to enforce one specific (max) line-length.
Reading modes
User’s intent
The user intends to improve visual comfort.
Author’s intent
Does not apply to authors but it could if we create a public API for authors to express intents related to reading modes.
Since authors have filed very few use cases at the moment, this is highly conditional.
What to do
Implementers should take two main variables into account: contrast and luminosity, which means they might want to invert some images or get rid of backgrounds in night mode.
Inverting images that should be inverted in night mode can’t be done well without an author’s intent though.